Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialeslam said
Courses Plus Student 6,734 PointsSwitch statements
I see that the java script course here didn't mention switch, so it`s not recommended to use it ?
1 Answer
Jonathan Grieve
Treehouse Moderator 91,253 PointsIt is good practice to use them, particularly when you otherwise would be using be using more than 3 or 4 else if blocks. It's pretty much personal preference though. I really do think they're well worth knowing.
My advice would be if you're using 3 or more else if blocks you would consider using a Switch block.