Created
March 29, 2012 21:49
-
-
Save rogerbraun/2244119 to your computer and use it in GitHub Desktop.
Folgende zusammenfügen
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
var rising = function(res, el) { | |
var subArr = res[res.length - 1]; | |
if(subArr && ((subArr[subArr.length - 1] + 1) == el)) { | |
subArr.push(el); | |
} else { | |
res.push([el]); | |
} | |
return res; | |
} | |
var temp = arr.reduce(rising, []); | |
console.log(temp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment