⚖️ Comparison Operators
Last Updated: 11th October 2025
Comparison operators are used to compare two values.
They return a Boolean value — true or false.
Hinglish Tip 🗣: Comparison ka matlab — “Dono values barabar hain ya nahi?”, “badi hai ya chhoti?”. Jaise real life me hum kehte hain - 5 bada hai 3 se → yahi comparison hai.
🗂 List of Comparison Operators
✏ Mini Example
let x = 10;
let y = "10";
let z = 5;
console.log(x == y); // true (value same)
console.log(x === y); // false (type different)
console.log(x != y); // false
console.log(x !== y); // true
console.log(x > z); // true
console.log(x <= z); // false
⚠️ Important Difference: == vs ===
💡 Always prefer === and !== for safer comparisons in JavaScript.
💡 Quick Practice
- Compare "10" and 10 using both == and ===.
- Check if 15 is greater than or equal to 10.
- Verify if "A" is less than "a" (hint: Unicode value compare hota hai).
- Compare two Boolean values using !==.
- Exercises Set 1
- Exercises Set 2
