Guest User

Untitled

a guest
May 26th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. /*
  2. Ruby:
  3.  
  4. 0.upto(10) do |i|
  5. # actions
  6. end
  7.  
  8. Javascript:
  9.  
  10. [0].upto(10).Do(function(i){
  11. // actions
  12. });
  13.  
  14. */
  15.  
  16. Array.prototype.upto = function(n){
  17. m = this[0]||0;
  18. return {Do: function(fn){
  19. for(i=m;i<=n;i++) fn(i);
  20. }};
  21. };
Add Comment
Please, Sign In to add comment