In javascript, is it better to use two equal signs or three when comparing variables -
this question has answer here:
i have noticed quite few people use 3 equals signs when comparing things in javascript, taught use two. can shed light on why use 3 or two, , why both work?
-thanks :)
another user has pointed out question has been asked, sorry guys, going @ answers on one.
all following evaluations return true
with ==
js will type-juggle.
1 == '1' 1 == 1 1 == true 0 != true 0 == false
with ===
js will not type-juggle
1 !== '1' 1 === 1 1 !== true 0 !== false
Comments
Post a Comment