Comparison Operators
Comparison Operators, as expressed by the name, are operators that can be used for comparing data.
For example, we can use the equals to (==) operator to check if two values are equal. This outputs true or false based on whether the two values are equal or not.
123let a = 5; let b = 10; console.log(a == b);
The expression a == b is known as a boolean expression because it evaluates into a boolean value (true or false).
The equals to operator (==) is not the same as the assignment operator (=).
There's a similar operator known as the not equals to (!=) operator. It simply returns true if the two values are not equal:
123let a = 5; let b = 10; console.log(a != b);
There are some other operators which can be used for comparing values:
1. What will be the output of the following code?
2. Which of the following operators checks if two values are equal?
3. What is the difference between = and == in JavaScript?
4. What will be the output of this code?
5. Which of the following statements will return true ?
Merci pour vos commentaires !
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Génial!
Completion taux amélioré à 1.33
Comparison Operators
Glissez pour afficher le menu
Comparison Operators, as expressed by the name, are operators that can be used for comparing data.
For example, we can use the equals to (==) operator to check if two values are equal. This outputs true or false based on whether the two values are equal or not.
123let a = 5; let b = 10; console.log(a == b);
The expression a == b is known as a boolean expression because it evaluates into a boolean value (true or false).
The equals to operator (==) is not the same as the assignment operator (=).
There's a similar operator known as the not equals to (!=) operator. It simply returns true if the two values are not equal:
123let a = 5; let b = 10; console.log(a != b);
There are some other operators which can be used for comparing values:
1. What will be the output of the following code?
2. Which of the following operators checks if two values are equal?
3. What is the difference between = and == in JavaScript?
4. What will be the output of this code?
5. Which of the following statements will return true ?
Merci pour vos commentaires !