Permalink
Cannot retrieve contributors at this time
12 lines (7 sloc)
493 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
git-workflow-exercise/04 - JS/difference-between-==-and-===-in-JS - Copy.md
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
== is used to check for relative equality, whereas === is used to check for strict equality. | |
In other words, the string '2' will evalutae to true when compared to the integer data type for 2 for equality. | |
=== will check to see if the contents AND data type are the same, so since a string and an integer aren't the same, it would | |
evaluate to false. | |
TLDR: | |
'2' == 2 will evaluate to True, since the contents are the same | |
'2' === 2 will evaluate to False, since the data types are different. |