Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- This is closure which I called dragon.It's bypassing all disadvantages of global variables and allows you to store and fetch two dimensional arrays.
- var dragon = (function(){var arr=[];for(var i=0;i<=5;i++){arr[i]=[];}return function(a,b){if(b%1 === 0){return arr[a][b];}else if(typeof b !== 'undefined'){arr[a].push(b);}else{return arr[a];}}})();
Advertisement
Add Comment
Please, Sign In to add comment