These are my variables.
value1= 15.8
value2 = 15.5
value3 = 15.3
My condition is, value1 should be greater than value2 and value2 should be greater than value3.
yes, I can achieve this through
console.log( (value1 > value2) && (value2 > value3));
I tried, console.log( (value1 > value2 > value3));
It looks like fine for me, but it returns false.
I want to know whether I can compare three or more variables like this, if yes what I missed here.
Thank you.
left- and right-handto js-equationvalue > value2 > value3will parse astrue > value3which forcestrueto be evaluated as a number giving you1 > value3which isfalse