Skip to content

Instantly share code, notes, and snippets.

@rogerbraun
Created March 29, 2012 21:49
Show Gist options
  • Save rogerbraun/2244119 to your computer and use it in GitHub Desktop.
Save rogerbraun/2244119 to your computer and use it in GitHub Desktop.
Folgende zusammenfügen
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