javascript - var A == var B == 1 looking for truthy. Not working. Is it possible? -
not sure doable, looking truth homecoming if, example.. var = 100; var b = 100;
(a == b == 100)
i figured homecoming true. because == b (they both 100) , such, both equal 100.
but false.
edit::: thanks, yeah - appreciate repsonses.. hoping there nifty shorhand doing (a === 100 ) && ( b === 100) etc... give thanks much.
either evaluates as
(a == b) == 100
or as
a == (b == 100)
in both cases compare boolean 100. of course of study false. want
(a==100) && (b==100)
to see going on might want run the illustration below jsfiddle:
var = 100; var b = 100; alert("b == 100: " + (b == 100)); alert("a == (b == 100):" + (a == (b == 100))); alert("a == b:" + (a == b)); alert("(a == b) == 100:" + ((a == b) == 100)); alert("a == b == 100):" + (a == b == 100)); alert("(a == 100) && (b == 100):" + ((a == 100) && (b == 100)));
javascript
No comments:
Post a Comment