JPDev@programming.dev to Programmer Humor@programming.dev · 10 months ago===programming.devimagemessage-square79fedilinkarrow-up1685arrow-down117
arrow-up1668arrow-down1image===programming.devJPDev@programming.dev to Programmer Humor@programming.dev · 10 months agomessage-square79fedilink
minus-squareSzethFriendOfNimi@lemmy.worldlinkfedilinkarrow-up128·edit-210 months agoSo in JavaScript there’s the assignment = and the comparator is == Since there’s no types JS will do implicit conversion before comparison when using == in a case like this if(false == '0'){ //this is true } But with === it doesn’t. It means literally compare these if(false === '0'){ //this is false }else{ //so this will execute instead } But this, however, will var someState = false; if(someState === false){ //this is true }
minus-squarerunswithjedi@lemmy.worldlinkfedilinkarrow-up72·10 months agoBest answer. Thanks Lemmyoverflow.
So in JavaScript there’s the assignment
and the comparator is
Since there’s no types JS will do implicit conversion before comparison when using == in a case like this
But with === it doesn’t. It means literally compare these
But this, however, will
Best answer. Thanks Lemmyoverflow.
Np. closed as duplicate