TechCodex@programming.dev to Programmer Humor@lemmy.mlEnglish · 1 year agoJavascript can create atomic bombsprogramming.devimagemessage-square56fedilinkarrow-up1514arrow-down143
arrow-up1471arrow-down1imageJavascript can create atomic bombsprogramming.devTechCodex@programming.dev to Programmer Humor@lemmy.mlEnglish · 1 year agomessage-square56fedilink
minus-squareadrian783@lemmy.worldlinkfedilinkarrow-up3·1 year ago2 equal signs will coerce the second operand into the type of first operand then do a comparison of it can. so 1 == “1” is true. this leads to strange bugs. 3 equal signs do not do implicit type conversion, cuts down on weird bugs. 1===“1” is false.
minus-squareTonyTonyChopper@mander.xyzlinkfedilinkarrow-up1·1 year agowow that seems super useful, thanks
2 equal signs will coerce the second operand into the type of first operand then do a comparison of it can. so 1 == “1” is true. this leads to strange bugs.
3 equal signs do not do implicit type conversion, cuts down on weird bugs. 1===“1” is false.
wow that seems super useful, thanks