Which operator do we use if we want to check if two variables store the same values of exactly the same type?
=
===
==
!==
Answers Explanation & Hints:
To check if two variables store the same values of exactly the same type in JavaScript, you would use the strict equality operator, which is “===”. Here’s an explanation of the different comparison operators you mentioned:
For comparing variables to check if they hold the same values of the same type, you should use the strict equality operator (===). For example: const variable1 = 5; const variable2 = 5; console.log(variable1 === variable2); // Output: true In the above example, both variable1 and variable2 hold the same value of 5, and since the strict equality operator is used, the comparison evaluates to true. |