3 ms·
when you pass the local "en-us" that means you use that, and not the user's locale. the formatting you desired, can also be easily defined with the options arg
by Meph504 10y ago
when you pass the local "en-us" that means you use that, and not the user's locale.
the formatting you desired, can also be easily defined with the options argument. see (https://jsfiddle.net/prn4823b/1/ https://jsfiddle.net/prn4823b/1/)
but these methods, are pretty new, so say we disregard them for a minute.
The serious issue to take note of here, is that you are defining everything, in a function you are calling every second.
you don't need a new date object every second, you don't need to redefine those arrays, you also instead of doing one conditional for amPm, and hour formatting, are doing each in their own ternary.
I'm not trying to be hyper critical, but I did to you, just like I do with most candidates that apply with me, and seeing this, it would make me doubt your statements about javascript.
I would also argue, that showing the time here is a bit odd, as typically for something like this, it would be the time of the contents last update, not their own time, they have a clock already.
Best of luck with getting a gig.
- oliv__ 10y agoYou're right. Your code is much cleaner. Otherwise the time itself is just something I liked having there; my OS has a clock too, I'm aware of that.