From e2decd07f049c6481be7d7a1fb1346366bfb6b30 Mon Sep 17 00:00:00 2001 From: HarrisonCreates Date: Tue, 16 Apr 2019 00:56:34 -0400 Subject: [PATCH] Pushing == vs === in 04 - JS --- 04 - JS/difference-between-==-and-===-in-JS.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 04 - JS/difference-between-==-and-===-in-JS.md diff --git a/04 - JS/difference-between-==-and-===-in-JS.md b/04 - JS/difference-between-==-and-===-in-JS.md new file mode 100644 index 0000000..dce5ff2 --- /dev/null +++ b/04 - JS/difference-between-==-and-===-in-JS.md @@ -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. \ No newline at end of file