eudaimonious
3/27/2014 - 1:06 AM

jsWUT

jsWUT

count=0
function once(fn) {
    var new_function = function(){
    //var has_been_called = false;
    //call original if count is < 1
    console.log("I am in the if statement");
    count++;
    console.log("I am counting: " + count);
    if (count > 1) {return undefined}
     
   //console.log("I am counting: " + count);
    return fn.apply(this,arguments);
    }
  return new_function;
}

// console.log("test")
// var my_function = console.log
// once(my_functon)