Generating all possible combinations of strings
I am trying to generate all possible combinations of a string. e.g. for the list below: a1q5z!H9, b1q5z!H9, c1q5z!H9, d1q5z!H9, a2q5z!H9 ... etc Rather than make lots of nested loops, I thought I would try something clever with MODULO ... but hit a wall. This is the Javascript I have come up with - any pointers to how I might go on? var c = [ ['a', 'b', 'c', 'd'], ['1', '2', '3', '4'], ['q', 'w', 'e', 'r'], ['5', '6', '7', '8'], ['z', 'x', 'c', 'v'], ['!', '"', '£', '$'], ['H', 'J', 'K', 'L'], ['9', '8', '7', '6'], ]; var o = document.getElementById('output'); var pw = ""; var chars = c.length