get slice of sorted array greater than passed in value
Array.prototype.sliceAfter = function(expr) {
var index = 0;
var found = this.some(function(v, i, a) {
if(v > expr) {
index = i;
return true;
}
});
if(!found) return [];
return this.slice(index);
};
var size = parseInt(process.argv[2]||"10");
var x = new Array(size);
var i = 0;
while(i < size) {
x[i] = ++i;
}
i = 0;
while(i < size) {
console.log(i + ": " + x.sliceAfter(i++));
}