Convert the challenge from the previous lesson into a switch statement. Here’s the problem from the previous lesson:
“Declare a variable called `batteryLevel` and assign it a number value between 0 and 100 to represent a percentage of a cell phone battery between 0% and 100%. Write an If/Else If/Else statement where if the battery level is less than 30, the string “Low battery” is logged to the console. And if the battery level is between 31 and 80, the string “Half-full battery” is logged to the console. And finally, if the current battery level doesn’t fit between any of those ranges, the string “Full battery” is logged to the console. Change the value of `batteryLevel` and run your code so that it enters every if/else if/ else block.”
If you get stuck or need assistance, you can click the button below to connect with a tutor.
For additional questions or technical support, email email@example.com.