I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
because you're not actually toggling the original boolean. I'm not sure it offers any benefit beyond using !b in the first place, though.
constuniqueArr=(arr)=>[...newSet(arr)];
I think that if you're going to use full words elsewhere, like isArray you should use it here, and make the function uniqueArray. Most of the time, I think if what you're wanting is a set, you should use it as a set. In those cases you probably don't need to convert it back to an array anyway!
To calculate the days between two dates,
we first find the absolute between two dates and then divide it with 86400000 which is equal to milliseconds in a single day
Except... days aren't always 86400 seconds long, and this will fail when times are close to daylight savings, for example. There's a reason date libraries are complicated :)
This could be simplified to
because you're not actually toggling the original boolean. I'm not sure it offers any benefit beyond using
!b
in the first place, though.I think that if you're going to use full words elsewhere, like
isArray
you should use it here, and make the functionuniqueArray
. Most of the time, I think if what you're wanting is a set, you should use it as a set. In those cases you probably don't need to convert it back to an array anyway!Except... days aren't always 86400 seconds long, and this will fail when times are close to daylight savings, for example. There's a reason date libraries are complicated :)
Woah, man!
This is really helpful, I appreciate your effort <3