This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
Strings **should** be considered as iterables #244
Closed
Description
openedon Oct 21, 2022
With #233, strings are not considered as iterables. It's complete nonsense.
for (const c of 'abc') console.log(c); // => 'a', 'b', 'c'
[...'abc']; // => ['a', 'b', 'c']
'abc'[Symbol.iterator](); // => StringIterator
// etc., many other cases, but only here:
Iterator.from('abc'); // => TypeError
WTF? Yes, making strings iterable was a controversial decision - but since they are already iterable and it's not possible to change it - maybe it's better to stop break the language by adding inconsistencies?
Metadata
Assignees
Labels
No labels
Activity