Skip to content

Instantly share code, notes, and snippets.

@dhchow
Created February 21, 2011 19:51
Show Gist options
  • Select an option

  • Save dhchow/837602 to your computer and use it in GitHub Desktop.

Select an option

Save dhchow/837602 to your computer and use it in GitHub Desktop.

Revisions

  1. dhchow created this gist Feb 21, 2011.
    8 changes: 8 additions & 0 deletions JS Quiz
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    function doesSomething(array){
    var result = [];
    for (var i = 0, l = array.length; i < l; i++){
    var type = Object.prototype.toString.call(array[i]).split(' ').pop().split(']').shift().toLowerCase();
    if (type) { flat = flat.concat(/^(array|collection|arguments|object)$/.test(type) ? doesSomething(array[i]) : array[i]); }
    }
    return result;
    }