Permutations: Difference between revisions

→‎Iteration: finaly got it right
(→‎Iteration: another typo)
(→‎Iteration: finaly got it right)
Line 2,496:
<lang JavaScript>
function perm(a) {
if (a.length < 2) return [a];
var c, d, b = [];
for (c = 0; c < a.length; c++) {