레퍼런스 shuffle()

shuffle()

Shuffles the elements of an array.

The first parameter, array, is the array to be shuffled. For example, calling shuffle(myArray) will shuffle the elements of myArray. By default, the original array won’t be modified. Instead, a copy will be created, shuffled, and returned.

The second parameter, modify, is optional. If true is passed, as in shuffle(myArray, true), then the array will be shuffled in place without making a copy.

예제

구문

shuffle(array, [bool])

매개변수

array
Array:

array to shuffle.

bool
Boolean:

if true, shuffle the original array in place. Defaults to false.

Returns

Array: shuffled array.
Notice any errors or typos? Please let us know. Please feel free to edit src/utilities/array_functions.js and open a pull request!

관련 레퍼런스