Skip to content

Instantly share code, notes, and snippets.

@robbiet480
Created April 26, 2014 06:20
Show Gist options
  • Save robbiet480/11313117 to your computer and use it in GitHub Desktop.
Save robbiet480/11313117 to your computer and use it in GitHub Desktop.
i should make a jslib named bullshitjs
var inputArray = [10, 20, 30, 42];
var addedArray = [];
inputArray.map(function(val,index){
var thisIndex = index;
if(thisIndex >= 1) {
var prevIndex = thisIndex-1;
}
addedArray.push(inputArray[thisIndex] + inputArray[prevIndex])
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment