I’m going through the Javascript course and keep getting errors for things I am not sure if it’s the console in CodeCademy or my code. For example, I wrote this:
let athleteFinalPosition = 'first place';
switch (athleteFinalPosition) {
case 'first place':
console.log('You get the gold medal');
break;
case 'second place':
console.log('You get the silver medal!');
break;
case 'third place':
console.log('You get the bronze medal!');
break;
default:
console.log('Invalid item');
break;
}
But was told it was wrong. When I finally gave up and look up the solution, the only difference I notice is the break line at the beginning. Would my code not work if it doesn’t have that break or is the CodeCademy console thing being a little strict?
let athleteFinalPosition = 'first place';
switch (athleteFinalPosition) {
case 'first place':
console.log('You get the gold medal');
break;
case 'second place':
console.log('You get the silver medal!');
break;
case 'third place':
console.log('You get the bronze medal!');
break;
default:
console.log('Invalid item');
break;
}
Thanks!