Ad
  • Custom User Avatar

    If you print it, it will (probably) use the newline.

  • Custom User Avatar

    Handlers (handling functions) are the subscribers of your Event object. The invocation context of a function is a value you get when you reference this inside the function. The requirement is, this inside the handlers should point to this of the emit method, i.e. the instance of the Event object. The error tells you it's not happening in your case.

    This functionality is needed so you could subscribe and unsubscribe to the event from within your handlers, like this:

    const myEvent = new Event();
    
    myEvent.subscribe(() => {
      // notice the use of "this" instead of the explicit "myEvent"
      this.subscribe(/* ... */);
      this.unsubscribe(/* ... */);
    })
    
  • Custom User Avatar

    Well, it's because there's no reset/limit for the hour specified in the kata. The kata only wants you to format in HH:MM:SS, in which HH is the highest in the order of the format.

  • Custom User Avatar

    No, they're not, they look alike, but you're escapeing the \n and doing so, it doesn't work as a new line.