Learn Switch Statements In 1 Minute

preview_player
Показать описание


🌎 Find Me Here:

#Shorts
Рекомендации по теме
Комментарии
Автор

I learned switch statements as case statements way back when. I would think of a bookcase with each case declaration as a shelf going more granular down to definitions of words.

SameAsAnyOtherStranger
Автор

It's 2023 and we're still trying to convince people to use the switch statement

ajzack
Автор

Thank you sir this is so helpful. I wasn't paying attention during the end of my coding class so this was very helpful

vedantsharma
Автор

Heck, YT, you suggested me the video first, then this short. Anyway, watched thrm both. Thanks Kyle

arskeliss
Автор

or could use a map( string, funcptr ) if you're going to have a lot of different options with a lot of unique code for each case.

mazthespaz
Автор

You used the wrong example to demonstrate the switch case, this is not a good use-case.
This is good compared to if-else, but instead an Object or a map could be used with just one console log statement.

Switch cases are good for executing code that can't be managed properly in a map or Object, considering this scenario where we only have to return a constant string value, the switch case doesn't make that much sense.

anuragpal
Автор

hv to put "break" on each case is kinda deal breaker, why not just provide "switch break()"

omnilothar
Автор

Idk it doesn’t make the code look any cleaner or more readable in my experience

willio
Автор

We need a video of hairstyle simplified please

michaelbelai
Автор

Jug-wire 😅

I was today years old when i noticed switch statements look like map/dictionary key value pairs, with case being key and what follows after colons being value and break representing comma in multiple map values 🤦

ToneArray
Автор

I've heard 'if else' statements were optimzed on Chrome engine and works better than switch().

ednh
Автор

Confused at first but became clearer after repeated viewing of this video. Does it function well for every situation where if else statements would be used?

jonathanjohnson
Автор

Hi can you make a video on using Fetch Api and storing values in MySQL workbench

akangshamuk
Автор

One cool thing I learned is you can write
switch (true)
and the cases inside can then be any valid JavaScript expression

samislam
Автор

You just found AI, congrats congrats👏

juliansyahbyte
Автор

Can a first comment get a like from a legendary tutor

anonymous-nzzl