[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • 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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

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