Created
April 26, 2014 06:20
-
-
Save robbiet480/11313117 to your computer and use it in GitHub Desktop.
i should make a jslib named bullshitjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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