הצטרף ל-Nostr
2026-05-27 10:56:28 UTC

Axel Rauschmayer on Nostr: Computing the “length” of a #JavaScript iterator: > ['a', ...

Computing the “length” of a #JavaScript iterator:

> ['a', 'b'].values().reduce((_acc, _cur, index) => index + 1)
2

Use case: How many code points does a string have?

> Iterator.from('🙈🙉🙊').reduce((_acc, _cur, index) => index + 1)
3