Skip to content

Instantly share code, notes, and snippets.

@robotlolita
Created November 19, 2010 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robotlolita/707273 to your computer and use it in GitHub Desktop.
Save robotlolita/707273 to your computer and use it in GitHub Desktop.
function flatten(list) {
var i = 0, len = list.length;
while (i++ < len)
if (list[i] && list[i].length)
list.splice.apply(list, [i, 1].concat(flatten(list[i])));
return list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment