How to Shuffle a JavaScript Array

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

There is no native function for shuffling the elements in a JavaScript array. This tutorial shows you how you can create your own shuffle function that will randomly shuffle the contents of an input array.
#javascript #node #nodejs #shuffle #array #webdevelopment #tutorial #programming

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

You could have used the Fisher-Yates algo

tonyvito
Автор

will it work if duplicates elements in array

anjalii