JavaScript Equality in 90 Seconds #JavaScriptJanuary
Watch the entire #JavaScriptJanuary series from the beginning!
In JavaScript there are many data types. There are strings, numbers, boolean, null, and undefined. It’s important to understand these types before comparing equality.
There are two ways to compare, or check for equality. We can use the double ==, or triple ===.
Double == checks for abstract equality, which means that it actually tries to convert the type using type coercion.
Triple === checks for strict equality, so the data types must match.
In general it is always best to use strict equality testing with the triple ===. This way you will not run into any false positive issues in your code. As a best practice, if you do need to check equality on different data types, do the conversion yourself first then check for equality.
I’ll be releasing a new video every day in January! Stay tuned..
_____________________________________
📚 Learn to CODE in just a FEW months here:
Treehouse Discount Code: https://treehouse.7eer.net/codeSTACKr
_____________________________________
🛠️ Tools I use:
🟠 Theme: https://marketplace.visualstudio.com/items?itemName=codestackr.codestackr-theme
🟠 Font: STACKr Code (Exclusive to my VS Code Course – https://vsCodeHero.com)
🟠 SuperHero Extension Pack: https://marketplace.visualstudio.com/items?itemName=codeSTACKr.superhero-extensions
🚢 Deploy for FREE on Vercel: https://vercel.com/ambassadors/codestackr
_____________________________________
💖 Show support!
PayPal: https://paypal.me/codeSTACKr
_____________________________________
Watch Next:
Web Development – Beginners Roadmap (2020) – https://youtu.be/iogabydg2y0
Playlist: Web Development For Beginners – https://www.youtube.com/watch?v=Ez4yHS2dsN8&list=PLkwxH9e_vrAJ0WbEsFA9W3I1W-g_BTsbt
_____________________________________
Connect With Me:
Website: http://www.codestackr.com
Twitter: https://twitter.com/codeSTACKr
Instagram: https://instagram.com/codeSTACKr/
Facebook: https://facebook.com/codeSTACKr
_____________________________________
** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you.
#JavaScriptJanuary #31Days31Videos #codeSTACKr
source