Skip to content

Instantly share code, notes, and snippets.

@tatat
Created February 17, 2013 11:27
Show Gist options
  • Save tatat/4971060 to your computer and use it in GitHub Desktop.
Save tatat/4971060 to your computer and use it in GitHub Desktop.
なんか良い
Number.prototype.to = function(n) {
for (var result = [], i = parseInt(this); i <= n; i ++) {
result.push(i);
}
return result;
};
console.log(10..to(20));
// [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment