Ad
  • Default User Avatar

    Aren't unspecified parameters default to undefined?

  • Custom User Avatar
  • Custom User Avatar

    Thanks! I understand now. My confusion was a result of me misreading the instructions. I can see that once is indeed only called once; I thought "logOnce" was the name of the "once" function; so I thought it was being called multiple times in the example given in the instructions.

  • Default User Avatar

    Please google "closure" and you should be more clear on what he have done here. This "once" function is returning another function. The call variable is set to true the first time in "once" and it will not be set back to true again since we are calling the returned function not the "once" function in the main program.

  • Custom User Avatar

    I guess I don't understand this Kata, but wouldn't this function always run the given argument function? You're setting call to true everytime, so in what case would it be false in the anonymous function that is being returned? I can see its being set to false in the anon function, but once that function runs and you call once again, you run through the beginning again which sets call to true, and would make the function run again, wouldnt it?

    Thakns.

  • Custom User Avatar

    When submitting, the error message returned would say "MyObject is undefined". I started out with this code:

    var myObj = {};
    myObj.proto = MyObject.prototype;

    This threw me off; I thought MyObject was already defined, but the error messages along with that not being explicitly laid out in the description of this problem made me uncertain about this. Eventually I just wanted to look at the answer. I get the intention of the problem now, but it should be made clearer in its description.

  • Custom User Avatar

    var j was for debbugging purposes. I forgot to remove it.

  • Custom User Avatar

    What is wrong with those implementations, if I may ask?

  • Custom User Avatar

    I might be incorrect, but I believe these 2 are the same thing?