In the following code it displays the switch command followed by a break. So you set your variable to the case you want to assign to it, and the price should appear in the pop up window. So what the switch command its doing it’s going threw every single different possible “case” that it could have and moves on from break to break.
var grade = "Premium";
switch ( grade ) {
case "Regular":
alert ("it's $3.15");
break;
case "Premium":
alert ("It's $3.35");
break;
case "Diesel":
alert ("It's $3.47");
break;
default:
alert ("That's not a valid grade");
}
I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More