I’ve tested it, your code do work. I think you’ve given the wrong input thus you’d think it doesn’t work.
Is this a code you write for your own project OR for an exercise?
If there’s an exercise, please provide:
- A link to your exercise (we need to see which exercise you’re talking about, some exercises have many steps/stages)
- Tell us what problem you faced or what error you had.
- Paste and format your code accordingly read more here ( We need to see your code so we can point out where is the problem)
If this code is for your own project, I would recommend using
.toLowerCase() method for your prompt. It changes every input into all lower case string.
var grade = prompt(“What grade is it ?”).toLowerCase();
Then change all your switch cases into all lower case “Diesel” into “diesel” , “Fuel” into “fuel” and so on.
I can’t post the full edited code for you, you have to learn to work it out, try make the changes yourself, test it if it works.
Post the code again with the format if you have any trouble.
Hope this helps. Cheers