Home › Forums › JavaScript › problem with switch › Reply To: problem with switch
October 21, 2013 at 4:22 pm
#153641
__
Participant
There shouldn’t be a semi-colon after the switch:
Also note that, because of semicolon insertion, you may still run into silent failures with your brackets on the left:
whatever ()
{
this doesn't always work
}
whatever (){
always put them on the right
}
This is a personal preference and never causes any real problems except in JavaScript.
I would also highly recommend always including a default
statement in your switch
es (even if it simply break
s without doing anything).