this post was submitted on 07 Sep 2023
27 points (68.5% liked)

Programmer Humor

32000 readers
1744 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 10 points 1 year ago (3 children)

Well I hate that. Is there a reason m=1 wouldn't be the same thing as m=!0?

[–] [email protected] 40 points 1 year ago

Types are dynamic so I think the ! operator converts int to bool in JS

[–] [email protected] 29 points 1 year ago

1 is truthy, but not the exact same thing as true, and the distinction can be important.

[–] [email protected] 8 points 1 year ago (1 children)

1 != true, 1 is an int, true is a boolean