To shuffle an array in JavaScript, we can use the Fisher-Yates shuffle algorithm. Here's an implementation of the algorithm:
index.tsx200 chars8 lines
To use this function, simply pass in an array as an argument, like so:
index.tsx142 chars4 lines
To reverse an array, we can use the reverse
method that is built-in to JavaScript arrays:
index.tsx110 chars4 lines
gistlibby LogSnag