Created
February 24, 2016 15:34
-
-
Save erayarslan/a8eed4dcc13845f9b08a to your computer and use it in GitHub Desktop.
javascript function iteration
This file contains hidden or 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
| (function () { | |
| var Next = function (arr) { | |
| var next = function (i) { | |
| return i != arr.length ? function () { | |
| arr[i](next(i + 1)); | |
| } : function () { | |
| } | |
| }; | |
| next(0)(); | |
| }; | |
| // node.js or commonjs support | |
| if (typeof exports !== "undefined") { | |
| if (typeof module !== "undefined" && module.exports) { | |
| exports = module.exports = Next; | |
| } | |
| exports.Next = Next; | |
| } else { | |
| this.Next = Next; | |
| } | |
| // amd support | |
| if (typeof define === 'function' && define.amd) { | |
| define('Next', [], function () { | |
| return Next; | |
| }); | |
| } | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment