Why won't this could run?
up vote
0
down vote
favorite
This code just wont execute when i open it in my browser google-chrome, been looking at it for over an hour and just cant seem to figure out whats going wrong, im currently studying at college and still learning the basics of javascript
var area = 'N';
var base = 105;
var addon = 0;
area = prompt("Enter Area Code A, F, G, B, N, P, R, C, H, W, Z");
switch (area)
case 'A':
case 'F':
case 'G':
addon = base + base * 0.05;
break;
case 'B':
case 'N':
case 'P':
case 'R':
addon = base + base * 0.07;
break;
case 'C':
case 'H':
case 'W':
case 'Z':
addon = base + base * 0.09;
break;
default
addon = base + base * 0.01;
alert("Premium is: £" + addon);
javascript html
add a comment |
up vote
0
down vote
favorite
This code just wont execute when i open it in my browser google-chrome, been looking at it for over an hour and just cant seem to figure out whats going wrong, im currently studying at college and still learning the basics of javascript
var area = 'N';
var base = 105;
var addon = 0;
area = prompt("Enter Area Code A, F, G, B, N, P, R, C, H, W, Z");
switch (area)
case 'A':
case 'F':
case 'G':
addon = base + base * 0.05;
break;
case 'B':
case 'N':
case 'P':
case 'R':
addon = base + base * 0.07;
break;
case 'C':
case 'H':
case 'W':
case 'Z':
addon = base + base * 0.09;
break;
default
addon = base + base * 0.01;
alert("Premium is: £" + addon);
javascript html
1
The error mesage is god's word, well not really, but it is helpful sometimes
– Nikko Khresna
Nov 9 at 20:06
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This code just wont execute when i open it in my browser google-chrome, been looking at it for over an hour and just cant seem to figure out whats going wrong, im currently studying at college and still learning the basics of javascript
var area = 'N';
var base = 105;
var addon = 0;
area = prompt("Enter Area Code A, F, G, B, N, P, R, C, H, W, Z");
switch (area)
case 'A':
case 'F':
case 'G':
addon = base + base * 0.05;
break;
case 'B':
case 'N':
case 'P':
case 'R':
addon = base + base * 0.07;
break;
case 'C':
case 'H':
case 'W':
case 'Z':
addon = base + base * 0.09;
break;
default
addon = base + base * 0.01;
alert("Premium is: £" + addon);
javascript html
This code just wont execute when i open it in my browser google-chrome, been looking at it for over an hour and just cant seem to figure out whats going wrong, im currently studying at college and still learning the basics of javascript
var area = 'N';
var base = 105;
var addon = 0;
area = prompt("Enter Area Code A, F, G, B, N, P, R, C, H, W, Z");
switch (area)
case 'A':
case 'F':
case 'G':
addon = base + base * 0.05;
break;
case 'B':
case 'N':
case 'P':
case 'R':
addon = base + base * 0.07;
break;
case 'C':
case 'H':
case 'W':
case 'Z':
addon = base + base * 0.09;
break;
default
addon = base + base * 0.01;
alert("Premium is: £" + addon);
var area = 'N';
var base = 105;
var addon = 0;
area = prompt("Enter Area Code A, F, G, B, N, P, R, C, H, W, Z");
switch (area)
case 'A':
case 'F':
case 'G':
addon = base + base * 0.05;
break;
case 'B':
case 'N':
case 'P':
case 'R':
addon = base + base * 0.07;
break;
case 'C':
case 'H':
case 'W':
case 'Z':
addon = base + base * 0.09;
break;
default
addon = base + base * 0.01;
alert("Premium is: £" + addon);
var area = 'N';
var base = 105;
var addon = 0;
area = prompt("Enter Area Code A, F, G, B, N, P, R, C, H, W, Z");
switch (area)
case 'A':
case 'F':
case 'G':
addon = base + base * 0.05;
break;
case 'B':
case 'N':
case 'P':
case 'R':
addon = base + base * 0.07;
break;
case 'C':
case 'H':
case 'W':
case 'Z':
addon = base + base * 0.09;
break;
default
addon = base + base * 0.01;
alert("Premium is: £" + addon);
javascript html
javascript html
edited Nov 9 at 20:24
connexo
19.4k63353
19.4k63353
asked Nov 9 at 19:53
Affy
92
92
1
The error mesage is god's word, well not really, but it is helpful sometimes
– Nikko Khresna
Nov 9 at 20:06
add a comment |
1
The error mesage is god's word, well not really, but it is helpful sometimes
– Nikko Khresna
Nov 9 at 20:06
1
1
The error mesage is god's word, well not really, but it is helpful sometimes
– Nikko Khresna
Nov 9 at 20:06
The error mesage is god's word, well not really, but it is helpful sometimes
– Nikko Khresna
Nov 9 at 20:06
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
I think you're missing a colon after default
. Should be like this:
default:
addon = base + base * 0.01;
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch for reference.
Also, it's a good idea to check your browser's developer console to catch errors like this one.
Thank you so much! i was going crazy trying to figure out why it wasn't working lol
– Affy
Nov 9 at 20:08
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
I think you're missing a colon after default
. Should be like this:
default:
addon = base + base * 0.01;
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch for reference.
Also, it's a good idea to check your browser's developer console to catch errors like this one.
Thank you so much! i was going crazy trying to figure out why it wasn't working lol
– Affy
Nov 9 at 20:08
add a comment |
up vote
3
down vote
accepted
I think you're missing a colon after default
. Should be like this:
default:
addon = base + base * 0.01;
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch for reference.
Also, it's a good idea to check your browser's developer console to catch errors like this one.
Thank you so much! i was going crazy trying to figure out why it wasn't working lol
– Affy
Nov 9 at 20:08
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
I think you're missing a colon after default
. Should be like this:
default:
addon = base + base * 0.01;
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch for reference.
Also, it's a good idea to check your browser's developer console to catch errors like this one.
I think you're missing a colon after default
. Should be like this:
default:
addon = base + base * 0.01;
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch for reference.
Also, it's a good idea to check your browser's developer console to catch errors like this one.
answered Nov 9 at 19:57
shkaper
528210
528210
Thank you so much! i was going crazy trying to figure out why it wasn't working lol
– Affy
Nov 9 at 20:08
add a comment |
Thank you so much! i was going crazy trying to figure out why it wasn't working lol
– Affy
Nov 9 at 20:08
Thank you so much! i was going crazy trying to figure out why it wasn't working lol
– Affy
Nov 9 at 20:08
Thank you so much! i was going crazy trying to figure out why it wasn't working lol
– Affy
Nov 9 at 20:08
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53232455%2fwhy-wont-this-could-run%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
The error mesage is god's word, well not really, but it is helpful sometimes
– Nikko Khresna
Nov 9 at 20:06