+ 1
i'm perplex... about the result of this code (from JS challenge). Someone have an explaination ?
var a=10, b=20, c=30 ; if (c > b > a) // it's seem true, but... {console.log ('1');} else {console.log ('2');} result = 2 // ?!?
4 odpowiedzi
+ 3
c > b > a //evaluate c>b
true > a //compare true with a
+ 4
well, it's like
(c > b) > a
(30 > 20) > 10
true > 10
// true in number = 1
1 > 10
false
else print 2
right ?
+ 1
yes, thats right
+ 1
thanks Taste...