mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 12:09:26 +00:00
add better note for generators
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* Use a generator so we can iterate and possibly break early.
|
||||
* @example
|
||||
* // to operate like a regular array. This gets kinda nullify generator benefits.
|
||||
* // to operate like a regular array. This kinda nullifies generator benefits, but worth knowing if you need the whole array.
|
||||
* const allActiveElements = [...activeElements()]
|
||||
*
|
||||
* // Earlier return
|
||||
* // Early return
|
||||
* for (const activeElement of activeElements()) {
|
||||
* if (<cond>) {
|
||||
* break; // Break the loop, dont need to iterate over the whole array or store an array in memory!
|
||||
|
||||
Reference in New Issue
Block a user