Thanks for this. It was great and really helpful. Might I suggest though that instead of setting the variable numbersToAddZeroTo and using multiple if statements, you instead use slice(). So for instance you can have: seconds = ('0' + seconds).slice(-2).
I think it's better this way plus if you look at the preview, you'll see that 'seconds' do not get prepended with zero. But again awesome tutorial! Very well laid out and easy to understand.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for this. It was great and really helpful. Might I suggest though that instead of setting the variable
numbersToAddZeroToand using multiple if statements, you instead useslice(). So for instance you can have:seconds = ('0' + seconds).slice(-2).I think it's better this way plus if you look at the preview, you'll see that 'seconds' do not get prepended with zero. But again awesome tutorial! Very well laid out and easy to understand.