Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js comparison operators

Javascript Comparison Operators
== Equal to
=== Equal value and equal type
!= Not equal
!== Not equal value or not equal type
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to
? Ternary operator
Comment

JavaScript Comparison Operators

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
Comment

Comparison operators in 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
Comment

JavaScript Comparison and Logical Operators

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

what are the comparison operators in javascript

<, >, <=, >=, ==, ===, !=, !==
Comment

PREVIOUS NEXT
Code Example
Javascript :: get class of object javascript 
Javascript :: firebase.database.ServerValue.increment 
Javascript :: function in javascript 
Javascript :: object.assign in node.js 
Javascript :: java script removing first three indexes 
Javascript :: convert excel file to json using node js 
Javascript :: get the max value from array js 
Javascript :: create react tailwind app 
Javascript :: useStyles 
Javascript :: running webpack application on production server 
Javascript :: custom js shopify 
Javascript :: Find the maximum number of an array js 
Javascript :: get subdomain from url javascript 
Javascript :: default javascript 
Javascript :: remove item from array 
Javascript :: random password generator javascript 
Javascript :: to htmlhow can i add the list in javascript 
Javascript :: pattern printing in javascript 
Javascript :: array of array of string js 
Javascript :: unexpected token < in json at position 0 coinbase 
Javascript :: js var part of var name 
Javascript :: uppercase each word javascript 
Javascript :: node js package nodemon error 
Javascript :: change h2 to h1 using javascript 
Javascript :: Material-ui account box icon 
Javascript :: flutter loops vs javascript loops 
Python :: abc list 
Python :: seaborn figsize 
Python :: import validation error in django 
Python :: change figure size pandas 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =