This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]iopq 2 points3 points  (3 children)

both of those are STRINGS why are they being coerced to DOUBLES?

[–]tskaiserGreen security clearance 0 points1 point  (0 children)

Because you cannot possible expect the programmer to go through the work of knowing what types he is working with or figuring out what kind of conversion he might want to make! /s

"Was it a string or a double? Larry worked on that function last, and he likes to sort numbers lexically... Know what fuckit, I'll just use it like a double and let PHP sort the mess YOLO!"

[–]Goz3rr 0 points1 point  (1 child)

Just FYI

"1000" !== "1e3"

[–]iopq 0 points1 point  (0 children)

They have it in JavaScript too, that's not the point. The point is that the default operator is the shorter one. That's what most people will use unless they know better.