Practical guides, tutorials, and insights from years of building web and desktop applications. Check out code examples you can actually use!
Comparison Operators in Javascript
Equals (==), not equals (!=), greater than (>), lesser than (<) - Javascript comparison operators cannot get more simple. Let’s dissect these operators a bit. Comparison operators are the ones that you use to.. well, compare. For example: let numCoffee = 3; if (numCoffee < 2) console.log("too few"); else if (numCoffee == 2) console.log("just right"); else console.log("crazy"); // output: crazy The expression within brackets is evaluated to true or false based on operator precedence. A succinct representation of the above totally real-world problem will be - ...