“Opérateurs de comparaison JavaScript” Réponses codées

=== JavaScript

// ===	means equal value and equal type
var x = 5

// true
x === 5

// false
x === "5"
Lazy Lapwing

Opérateurs de comparaison en JavaScript

// equal operator
console.log(2 == 2); // true
console.log(2 == '2'); // true

// not equal operator
console.log(3 != 2); // true
console.log('hello' != 'Hello'); // true

// strict equal operator
console.log(2 === 2); // true
console.log(2 === '2'); // false

// strict not equal operator
console.log(2 !== '2'); // true
console.log(2 !== 2); // false
SAMER SAEID

Opérateurs de comparaison JavaScript

Operator	Description	Example
==	Equal to: returns true if the operands are equal	x == y
!=	Not equal to: returns true if the operands are not equal	x != y
===	Strict equal to: true if the operands are equal and of the same type	x === y
!==	Strict not equal to: true if the operands are equal but of different type or not equal at all	x !== y
>	Greater than: true if left operand is greater than the right operand	x > y
>=	Greater than or equal to: true if left operand is greater than or equal to the right operand	x >= y
<	Less than: true if the left operand is less than the right operand	x < y
<=	Less than or equal to: true if the left operand is less than or equal to the right operand	x <= y
SAMER SAEID

Comparaison JavaScript et opérateurs logiques

if (age < 18) text = "Too young to buy alcohol";
naly moslih

Quels sont les opérateurs de comparaison en javascript

<, >, <=, >=, ==, ===, !=, !==
Doubtful Dunlin

Réponses similaires à “Opérateurs de comparaison JavaScript”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code