Strict Equality or Identity Operators in JavaScript

In JavaScript, identity operators are used to compare the equality of two values while also considering their data types. There are two identity operators:

  • Strict Equality Operator (===)
    • The strict equality operator (===) checks for equality between two values while considering both their values and data types. It returns true if both the values and data types are identical, and false otherwise
  • Equality Operator (==)
    • The equality operator (==) also checks for equality between two values, but it performs type coercion if the data types are different. It tries to convert one or both operands to the same type before making the comparison.

Source Code

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Tutor Joes</title>
	<script src="js/script.js"></script>
To download raw file Click Here

//strict equality or Identity Operator

let a=10;
let b='10';
To download raw file Click Here

List of Programs

JS Practical Questions & Answers

JS Practical Project