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);












share|improve this question



















  • 1




    The error mesage is god's word, well not really, but it is helpful sometimes
    – Nikko Khresna
    Nov 9 at 20:06














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);












share|improve this question



















  • 1




    The error mesage is god's word, well not really, but it is helpful sometimes
    – Nikko Khresna
    Nov 9 at 20:06












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);












share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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












  • 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












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.






share|improve this answer




















  • Thank you so much! i was going crazy trying to figure out why it wasn't working lol
    – Affy
    Nov 9 at 20:08










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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

























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.






share|improve this answer




















  • Thank you so much! i was going crazy trying to figure out why it wasn't working lol
    – Affy
    Nov 9 at 20:08














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.






share|improve this answer




















  • Thank you so much! i was going crazy trying to figure out why it wasn't working lol
    – Affy
    Nov 9 at 20:08












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.






share|improve this answer












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.







share|improve this answer












share|improve this answer



share|improve this answer










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
















  • 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

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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





















































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







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo