Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Great explanation, thanks. I misunderstand the function of Date.setFullYear(), now it all makes sense. setFullYear() will add "365" days to current date, so after adding 356 days, 29 February will be 1 March next year, if next year don't have 29 in February. It's really clever!!

  • Custom User Avatar

    I've looked up the getMonth function, but I still don't get why t1.getDay() !== t0.getDay but t1.getMonth() === t0.getMonth() will get the correct answer? Because while t1.getMonth() === t0.getMonth() will also return true and stop the loop.
    Could you please tell me about the logic here?