Using a JavaScript Generator Function to step through a Compass Construction of a Pentagon
HTML-код
- Опубликовано: 21 авг 2024
- In this video we look an HTML with an empty SVG element that is populated by JavaScript. The figure generated shows a ruler-compass construction of a pentagon. Most of the JavaScript code was placed in a "generator function" with many instances of the keyword "yield". The code establishes a generator object and uses an on-click method call the next() method of the generator object. This allows the user to walk through the complicated figure construction step-by-step.
www1.lasalle.edu/~blum/c152wks/SVG_Pentagon_Compass_Construction_2.html