4 ms·
I think the answer to "can something be fuzzy equal to one value and strictly equal to another in JS?" has an easy answer that doesn't take much effort to find.
by wambotron 13y ago
I think the answer to "can something be fuzzy equal to one value and strictly equal to another in JS?" has an easy answer that doesn't take much effort to find. This might be cooler in another language, though.
var b = 2;
b == '2'; // true
b === 2; // true
- neil_s 13y agoThis is what I was gonna say! I don't know much JS, but after @sgdesign 's recent primer, the answer to the first two conditions seems obvious, b=="2" and b===2. Herpderp is just a cop out, since you could have infinite other variables that b equals, if you set the value to the same thing!
- philip_roberts 13y agoExcept the question was b==1 && b===2
- mikeryan 13y agoI think you missed a bit of his point which was to make that exact expression evaluate as true (b == 1 && b===2 && b === herpderp)