Web Dev Roadmap for Beginners (Free!): https://bit.ly/DaveGrayWebDevRoadmap

STOP Using Switch! In this tutorial we'll discuss why you should stop using switch and use a couple of other available options instead of using switch statements. This tutorial applies to both Vanilla Javascript and Node.js.

Subscribe https://bit.ly/3nGHmNn

JavaScript for Beginners: Full Course (8 hours): https://youtu.be/EfAl9bwzVZk

STOP Using Switch Statements! Use These Instead...

(00:00) Intro
(00:05) Welcome
(00:18) Switch Statements
(01:34) Lookup Objects (or object lookups)
(02:58) How to have a default value
(03:55) ES6 Maps
(05:40) Review
(06:14) Maps vs Objects

Reference:
MDN Maps vs Objects:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map

Follow Me:
Twitter: https://twitter.com/yesdavidgray
LinkedIn: https://www.linkedin.com/in/davidagray/
Blog: https://yesdavidgray.com
Reddit: https://www.reddit.com/user/DaveOnEleven

Was this tutorial about avoiding switch statements and instead using object lookups or Map objects helpful? If so, please share. Let me know your thoughts in the comments.

#stop #switch #statements