>PHP/JS < Python < C < Java < microsoft visual basic
Wtf javascript
Spoken like a true nodev.
Protip:
[code]
const d = (new Date()).valueOf();
d + 1000;
[/spoiler]
Your probably also think using [ ] operator vs pointers difference is negligible!
This is your brain on stupid.
Spottet the redditor pajeet.
(new Date((new Date()).valueOf() +1000));
I'm not sure why anyone would directly add a number to a date but fine.
There is no difference! It's all syntactic sugar.
Small price to pay to avoid bugs caused by implicit type conversion:
5 + null // returns 5 because null is converted to 0"5" + null // returns "5null" because null is converted to "null""5" + 2 // returns "52" because 2 is converted to "2""5" - 2 // returns 3 because "5" is converted to 5"5" * "2" // returns 10 because "5" and "2" are converted to 5 and 2
You have to admit that in a language like C where every bit can have critical meaning, having implicit numeric conversions everywhere is fucking stupid. I imagine they would have fixed a lot of things like that by now if not for the header model where there's no separation between new and old code.
Nice tautology, it solves nothing.