permutation javascript code just for fun 2 versions of a function that returns all permutation of a string one functional (recursive) and one imperative (iterative)