Last updated 2 years ago
Was this helpful?
⟩ ⟩ ⟩ ⟩ ⟩ compostion
*zip() - zip iterables into a single generator function.
*interleave() - interleave the values of iterables.
*sequence() - yield values sequentially.
syntax:yield* <generator object>
yield* <generator object>
⬆️ 需要: *list()
// ⭐️ composition of generator functions function* alphaNumericCodes(){ yield* list(26, {start: 97}); // a..z // ⭐️ Note: use of `yield*` yield* list(26, {start: 65}); // A..Z yield* list(10, {start: 48}); // 0..9 } // generator object -> array [...alphaNumericCodes()] .map(n => String.fromCharCode(n)) // array of codes -> array of characters .join('') // 'a..zA..Z0..9'