The best way to reverse an array in Javascript #shorts

preview_player
Показать описание
Just sharing a simple utility for reversing a javascript array

------------

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

Only thing to watch out for is the original array is mutated as well as returning the reversed array.
So make sure you don't need the original array in normal order, or make a copy of the array and then reverse it.

Evikeuklavier
Автор

Did you use an extension to work with js in the terminal or did you install node?

mastersquid
Автор

This can work with strings if you .split("") them before reversing, and .join("") them after!

tamc
Автор

People who code their own algorithm ☠️☠️

kristiyanbalevski
welcome to shbcf.ru