Skip to content

Commit

Permalink
Merge pull request #12 from bpd01001/feature/==-versus-===-JS
Browse files Browse the repository at this point in the history
Pushing == vs === in 04 - JS
  • Loading branch information
bpd01001 authored Apr 16, 2019
2 parents 3b56325 + e2decd0 commit 8b04632
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 04 - JS/difference-between-==-and-===-in-JS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
== 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.

0 comments on commit 8b04632

Please sign in to comment.