I need help with a prompt that says: "Specify the operation you want the machine to perform a Simple Math calculation b Simple Physics formulae c Quote of the Day" That part I have down but I want it so that when they enter "a" JavaScript uses compute_Math_op(), "b" compute_Physical_quantities, or "c" quote_of_the_day() function. Thus far I have <script type="text/javascript"> var y = prompt("Specify the operation you want the machine to perform /n a Simple Math calculation /n b Simple Physics formulae /n c Quote of the Day",""); switch(x){ case ‘a’: compute_Math_op(); break; case ‘b’: compute_Physical_quantities(); break; case ‘c’: quote_of_the_day(); break; } </script> Really appreciate any help. Thanks
<script type="text/javascript"> var y = prompt("Specify the operation you want the machine to perform /n a Simple Math calculation /n b Simple Physics formulae /n c Quote of the Day",""); switch(y){ case ‘a’: compute_Math_op(); break; case ‘b’: compute_Physical_quantities(); break; case ‘c’: quote_of_the_day(); break; } </script> Code (markup): Isn't it suppose to be switch(y)?
var y = prompt('Specify the operation you want the machine to perform:' +'\n a Simple Math calculation' +'\n b Simple Physics formulae' +'\n c Quote of the Day', ''); switch(y){ case 'a': compute_Math_op(); break; case 'b': compute_Physical_quantities(); break; case 'c': quote_of_the_day(); } PHP: