Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Ruby:
- 0.upto(10) do |i|
- # actions
- end
- Javascript:
- [0].upto(10).Do(function(i){
- // actions
- });
- */
- Array.prototype.upto = function(n){
- m = this[0]||0;
- return {Do: function(fn){
- for(i=m;i<=n;i++) fn(i);
- }};
- };
Add Comment
Please, Sign In to add comment