Skip to content

Instantly share code, notes, and snippets.

@ready4god2513
Created November 1, 2014 06:52
Show Gist options
  • Select an option

  • Save ready4god2513/32afd776c28d04fe44aa to your computer and use it in GitHub Desktop.

Select an option

Save ready4god2513/32afd776c28d04fe44aa to your computer and use it in GitHub Desktop.

Revisions

  1. ready4god2513 created this gist Nov 1, 2014.
    12 changes: 12 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    Array.prototype.alternate = function(other){
    var result = [];

    this.forEach(function(i){
    result.push(i);
    if(other.length > 0){
    result.push(other.shift());
    }
    });

    return result;
    };