Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

JavaScript Comparison and Logical Operators

In this tutorial I’m going to learn how to use Comparison and logical operators in laravel. Comparison operators compare two values and give back a boolean value: either true or false. Comparison operators are used in decision making and loops.

OperatorDescriptionExample
==Equal to: true if the operands are equal5==5; //true
!=Not equal to: true if the operands are not equal5!=5; //false
===Strict equal to: true if the operands are equal and of the same type5==='5'; //false
!==Strict not equal to: true if the operands are equal but of different type or not equal at all5!=='5'; //true
>Greater than: true if the left operand is greater than the right operand3>2; //true
>=Greater than or equal to: true if the left operand is greater than or equal to the right operand3>=3; //true
<Less than: true if the left operand is less than the right operand3<2; //false
<=Less than or equal to: true if the left operand is less than or equal to the right operand2<=2; //true

Example 1: Equal to Operator

const a = 5, b = 2, c = 'hello';

console.log(a == 5);     // true
console.log(b == '2');   // true
console.log(c == 'Hello');  // false

Output:-

Not equal to !=

const a = 3,
b = 'hello';
// not equal operator
console.log(a != 2);
console.log(b != 'Hello');

Output:-

Strict equal to

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

Output:-

Thanks for reading 👍👍

Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.

Related Posts

How to use Global Variable using JavaScript in Laravel ?

What is Global Variable ? A global variable is a variable that is defined and accessible throughout the entire program or a significant portion of it, rather…

How to print Object Value using Array in Javascript ?

In this tutorial i’m going to print the object value using javascript ? First go to controller function and put below code. Next go to blade page…

How to Count the Vowels value in array objects ?

Ini this tutorial we’re going to learn how to get the value form array object and count only vowels value. 1st step create below file name Put…

How to print multidimensional array in Console ?

In this tutorial we’re going to learn how to print multidimensional array in console.log Using this I want to print all data whatever coming in log file…

How to remove fake path from url in laravel ?

In this tutorial we’re going to learn how to remove fake path from url in laravel using javascript. Now fakepath removing successfully form url 👍

List of My Blogs Written from May to October 2023

List of My Blogs Written in May 2023 1 How to Show Notification using Sweet Alert in Laravel 9 2 How to use Soft Delete and Restore…

0 0 votes
Article Rating
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback

[…] JavaScript Comparison and Logical Operators […]

1
0
Would love your thoughts, please comment.x
()
x