How To Find Permutations Of An Array In Javascript