this post was submitted on 08 Mar 2024
474 points (98.2% liked)

Programmer Humor

32495 readers
679 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] 28 points 8 months ago (19 children)
(+x) % 2 == 0

If you forget for a second it's Javascript, the language will turn back and bite you.

[–] [email protected] 5 points 8 months ago (13 children)

I am not good friends with js, what did I miss?

[–] [email protected] 6 points 8 months ago (3 children)

Not a JS dev either but ===.

Not really sure what the (+x) is about

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

the remainder operator should return a number or a NaN right? do we actually need the triple here?

[–] [email protected] 2 points 8 months ago* (last edited 8 months ago) (1 children)

Not really. But with JS it's better safe than sorry.

The GP's addition is unnecessary, but I fully support anyone that decides to do it.

[–] [email protected] 2 points 8 months ago
load more comments (1 replies)
load more comments (10 replies)
load more comments (15 replies)