Why not break; and default?


#1

Why shouldn't I use break; and default in the end of the code?
Thank you

var feeling = ("Are you feeling happy? Please, type YES or NO").toUpperCase();
var animal = ("Which animal do you prefer to stay now? A CAT or a DOG?").toUpperCase();
var user = ("You are walking in a forest and you see the there is a bridge above a sea, you can back or you go to there with the animal you're with. What do you prefer to choose? to GO or to BACK?").toUpperCase();

switch (user) {
case 'GO':
if ( feeling === "yes" && animal === "cat") {
console.log("be careful otherwise the cat will sleep during the walk, hehe")
}else{
console.log("if you choosed a dog dont let him run very much!");
}
break;
case 'BACK':
if ( feeling === "no" || animal === "dog") {
console.log("that's sad that you are going to back with your animal!");

    }

}


#2

In
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch
[quote]

switch (parameter-expression) {
  case value1:
    //Statements executed 
    //      when the VALUE of expression matches value1
    [break;]
  case value2:
     //Statements executed 
    //      when the VALUE of expression matches value2
    [break;]
 ...
  case valueN:
    //Statements executed 
    //      when the VALUE of expression matches valueN
    [break;]
  default:
    //Statements executed 
    //      when none of the VALUE's match the VALUE of the expression
    [break;]
}

= = = = = = = = = = = = = = = = = = = = = = = = = = = =

The switch statement evaluates an parameter-expression,
matching the parameter-expression's VALUE to a case clause,
and executes statements associated with that case.
( and with the break or return-statement will exit the switch statement )
[end-quote]