Created
January 21, 2014 12:01
-
-
Save Rendez/8538785 to your computer and use it in GitHub Desktop.
Ruby port of 'times' function in jquery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.times = function(callback) { | |
var i = 0; | |
do { callback(i); } while (this[0] > ++i); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If a scope and arguments are needed to pass to callback(), then use $.proxy.