What is the <> operator in JavaScript?

  • A+
Category:Languages

I just ran into JavaScript code which looks like this:

let b = 0; let d = 1 <b> 2; console.log(d)

So what does <b> mean?


There is no <> operator in JavaScript. let d = 1 <b> 2; is the same as:

let d = (1 < b) > 2; 

Which is always false, because 1 < b is either true or false and true > 2 and false > 2 are both false.

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: