Sleepless One@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 3 days agoThe JavaScript type coercion algorithmlemmy.mlimagemessage-square44fedilinkarrow-up1122arrow-down12file-text
arrow-up1120arrow-down1imageThe JavaScript type coercion algorithmlemmy.mlSleepless One@lemmy.ml to Programmer Humor@lemmy.mlEnglish · 3 days agomessage-square44fedilinkfile-text
minus-squareTelemachus93@slrpnk.netlinkfedilinkarrow-up3·3 days agoIn other languages that shouldn’t be equal either though, right? Maybe you meant if (2){ console.log("nonzero ints are truthy") } else { console.log("no they're not") } Which would output nonzero ints are truthy and that would actually work in all languages I know. But that’s different from being equal.
minus-squareretrolasered@feddit.uklinkfedilinkEnglisharrow-up2·2 days agoYeah its checking for not null with if isnt it. Maybe thats what has me confused
In other languages that shouldn’t be equal either though, right?
Maybe you meant
if (2){ console.log("nonzero ints are truthy") } else { console.log("no they're not") }
Which would output
nonzero ints are truthy
and that would actually work in all languages I know. But that’s different from being equal.
Yeah its checking for not null with if isnt it. Maybe thats what has me confused