Practice Review: Fix the Switch Statement

Let's see how well you understand the syntax for the "switch" statement in this practice exercise. In Unit 2, we described validating code using linters. First, copy the following code into the left pane of the JSHint window. Then, examine the errors and fix the code. This exercise does not count towards your grade. It is just for practice!


switch (fruittype) {
case 'Oranges':
console.log('Oranges are $0.59 a pound.');
break;
case 'Apples':
console.log('Apples are $0.32 a pound.')
break;
case 'Bananas':
console.log('Bananas are $0.48 a pound.');
break;
case 'Cherries':
console.log('Cherries are $3.00 a pound.');

default:
console.log(`Sorry, we are out of ${fruittype}.`);
}
console.log("Is there anything else you'd like?");
;

Click https://jshint.com/ link to open resource.