This file contains 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
function acc(pV, cV) { | |
if (cV instanceof Array) { | |
return pV + cV.reduce(acc, 0); | |
} else if (typeof cV == 'number') { | |
return pV + cV; | |
} | |
} | |
function arrSum(i) { | |
return i.reduce(acc, 0); |
This file contains 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
function monkey(arr) { | |
var len = arr.length, | |
cur, | |
finalVal = 0, | |
i; | |
for (i = 0; i < len; i++) { | |
cur = arr[i]; | |
if (cur instanceof Array) { | |
finalVal += monkey(cur); |
This file contains 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
function testing () { | |
var test = 'something' | |
, testing | |
, someother | |
; | |
// Cursor at correct position | |
var something, | |
yes, // Had to manually tab this line over |