permutations

permutations ( array array ) : array

Returns all possible permutations of an array

Example


maps = ["chocolate","ice cream","banana split"]
console(permutations(maps))
/*-> [
[chocolate, ice cream, banana split],
[chocolate, banana split, ice cream],
[ice cream, chocolate, banana split],
[ice cream, banana split, chocolate],
[banana split, chocolate, ice cream],
[banana split, ice cream, chocolate]
]*/


See also

generateCombinations

Parameters

array