Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
ddit6044yIf it is null return it and if it is not null return it.
If you are at a red light drive forward, if you are not at a red light drive forward.
If you are suicidal, kill yourself, if you are not suicidal, kill yourself. -
@theuser I remember hearing about == and === operators being different. So for example if null == 0 and null =/= 0 if different operators are used, it could be written as a shorthand catch multiple invalid states.
-
theuser48024y@HitWRight Yes, they use the same comparison algorithm, but the triple equals will not convert falsey and truthy values before comparing.
If you do "undefined == null" it will return true because both values are coerced to false (they are falsey).
"Boolean(undefined) === Boolean(null)" will return true because you are doing a manual explicit conversion beforehand.
Related Rants
-
linuxxx32*client calls in* Me: good morning, how can I help you? Client: my ip is blocked, could you unblock it for m...
-
DRSDavidSoft28Found this in our codebase, apparently one of my co-workers had written this
-
jsPaysMyBills27When you have something in your clipboard but then press Ctrl+C instead of Ctrl+V and end up with a blank line...
I think the dev missed a nullcheck before `handlebars.compile(name)`, don't you think?
// this snippet is from our product's repo ;)
rant
ffs
null
nullcheck
why
wtf
smh
are you serious