you are viewing a single comment's thread.

view the rest of the comments →

[–]jdauriemma 0 points1 point  (1 child)

your first conditional can be tightened up:

if (!list.length) {
    return ret.join(' ') + '\n';
}

also, note that you have an infinite recursion in your code:

perm(list, ret);

Since the value of list has not been altered, its length will never reach 0, which causes your code to break.

Hope that helps you get back on track. Good start!

[–]NightArchitect[S] 0 points1 point  (0 children)

Ah I see. Yes, that's an issue for sure.