+ 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 // ?!?

15th Oct 2019, 5:44 AM
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎ - avatar
4 Réponses
+ 3
c > b > a //evaluate c>b true > a //compare true with a
15th Oct 2019, 5:49 AM
Taste
Taste - avatar
+ 4
well, it's like (c > b) > a (30 > 20) > 10 true > 10 // true in number = 1 1 > 10 false else print 2 right ?
15th Oct 2019, 6:38 AM
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎ - avatar
+ 1
yes, thats right
15th Oct 2019, 6:45 AM
Taste
Taste - avatar
+ 1
thanks Taste...
15th Oct 2019, 8:43 AM
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎
Oneill~Онеилл~奥尼尔~ओनील~اونیل~*‎ - avatar