607
you are viewing a single comment's thread
view the rest of the comments
[-] rikudou@lemmings.world 1 points 1 year ago

It seems it is that way, which is weird. You should always convert to the widest type, meaning string for comparing numbers and strings. I just checked that 1 == "01" is true, which means that "01" gets cast to an integer. And according to the document it might be that for example 1 == "a" would basically be interpreted as 1 === NaN which is false.

this post was submitted on 14 Aug 2023
607 points (92.6% liked)

Programmer Humor

32365 readers
293 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS