Опубликовано: 8 мая 2019 г.
DRAKON's "For loop" icon is a visual way to loop over arrays in JavaScript.
The "For loop" icon produces code which is:
1. Efficient.
2. Reliable.
3. Compatible with older browsers.
https://drakon.tech/How to build a loop that iterates over a JavaScript array.Add a "For loop" icon.
Inside the loop start icon, put the loop variable, semicolon, and then the collection.
Example:
item; items
Iterating a JavaScript array with a For loop icon:
Note:
The collection expression will be evaluated only once.
Do not use any keywords like "for" or "foreach".
Do not use "let" or "var".
It is okay to use "await" inside the loop.
An alternative format for a low-level loop:
i = 0; i < items.length; i++
A low-level "For loop" icon:
A low-level For loop icon