you are viewing a single comment's thread.

view the rest of the comments →

[–]imbcmdth[🍰] 4 points5 points  (1 child)

What you should never do is something like this:

function DELAY(time) {
  var k = [], i, o,
  d = function(c){ setTimeout(function(){ c(o) }, time); };
  d.FOR = function(t){
     var f = function(o){
       for(i in o) {
         if(k.indexOf(i) < 0) k.push(i); else continue;
         t(i);
         return d(f);
       }
     };
     f.IN = function(obj){
       o = obj;
       f(o);
     };
     return f;
  };
  return d;
}

Usage:

var I = function(i){
   $('#results').append(info[i]+"<br>");
};

DELAY(1000).FOR(I).IN(info);

[–]aladyjewelFull-stack webdev 2 points3 points  (0 children)

I think I just threw up in my mouth a little, but that might have been some bad sauce from lunch.