A prototype to encapsulate permutations in javascript.