Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

problem with a simple switch code on java script

hi
i write this code for learning purposes but  its not working please tell me what it the problem with this code:
Var grade = "premium";
switch ( grade ) {
	case "premium":
		alert ("You select premium");
		break;
	case "Regular":
		alert ("you select Regular");
		break;
	case "Diesel":
		alert ("you select Diesel");
		break;
	default:
		alert ("you don't select nothing");
}
		

Open in new window


thanks
0
bill201
Asked:
bill201
3 Solutions
 
käµfm³d 👽Commented:
Javascript is case-sensitive. The keyword is var--lowercase "v"--not Var.
0
 
leakim971PluritechnicianCommented:
Var is lowercase :
var grade = "premium"
test page : http://jsfiddle.net/TVkwJ/
0
 
BlueYonderCommented:
The javascript looks fine.  Add this as a function using the example on http://www.w3schools.com/js/js_functions.asp.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
käµfm³d 👽Commented:
All due respect, I'm not sure why BlueYonder's comment is considered to be a solution, since the Javascript was not fine...
0
 
bill201Author Commented:
You're right.  but still he tried    to help and he brought a similar and excellent  code so  for a thanks I gave him points.
0
 
bill201Author Commented:
Dear Kaufmed You deserved more points but 500 it's the best I can give and I wanted to please everyone.
0
 
käµfm³d 👽Commented:
I'm good on the points. If his post helped you, then that's what matters  = )

I didn't look at his link, so I have no idea if it was beneficial.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now