JavaScript Tips — Create an array and map it in a single call using Array.from

preview_player
Показать описание


#javascript
Рекомендации по теме
Комментарии
Автор

Thats something i didnt knew.
So basically the second argument of .from() is a transformer function being called before from() actually uses the passed value to construct an array.

Honestly, thats good to know. i usually perform the transformation myself.
Being able to pass that into the generator fn may add some sugar to the code.

Chrrs
Автор

interesting. anyone know if this might have performance advantages for very large arrays?

FunctionGermany
welcome to shbcf.ru