☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 1 year agoThe Divine Trinity of JavaScriptlemmy.mlimagemessage-square10fedilinkarrow-up1190arrow-down17
arrow-up1183arrow-down1imageThe Divine Trinity of JavaScriptlemmy.ml☆ Yσɠƚԋσʂ ☆@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 1 year agomessage-square10fedilink
minus-squarexmunk@sh.itjust.workslinkfedilinkarrow-up15arrow-down3·1 year ago== Well there’s your problem, you’re using an operator that shouldn’t exist. Triple equals all the things and if you want to coerce types write it out explicitly.
minus-squaremogoh@lemmy.mllinkfedilinkarrow-up17·1 year agoWhile you are basically right, the problem is that there is an operator that should not exist. Though that is not the biggest problem of JavaScript.
minus-squaredeadbeef79000@lemmy.nzlinkfedilinkarrow-up3·1 year agoSurprise Type coercion is our greatest weapon! What about the limitless coffers of Rome implicit global scope? Well then, surprise type coercion and the limitless coffers of Rome implicit global scope are our greatest weapons.
minus-squareZagorath@aussie.zonelinkfedilinkarrow-up6·1 year ago== is acceptable for null checks. And basically nothing else.
minus-squareshrugal@lemm.eelinkfedilinkarrow-up2·1 year agoIt should probably be replaced with a more bespoke operator for that, like x isempty or something.
minus-squareJustas🇱🇹@sh.itjust.workslinkfedilinkarrow-up2·1 year ago["a"] + ["b"] = "ab" Goodnight, everyone.
Well there’s your problem, you’re using an operator that shouldn’t exist. Triple equals all the things and if you want to coerce types write it out explicitly.
While you are basically right, the problem is that there is an operator that should not exist. Though that is not the biggest problem of JavaScript.
SurpriseType coercion is our greatest weapon!What about the
limitless coffers of Romeimplicit global scope?Well then,
surprisetype coercion andthe limitless coffers of Romeimplicit global scope are our greatest weapons.== is acceptable for null checks. And basically nothing else.
It should probably be replaced with a more bespoke operator for that, like
x isempty
or something.The
??
operator?["a"] + ["b"] = "ab"
Goodnight, everyone.