power set, combination, and permutation in JavaScript