difficulties in javascript coding [on hold]
- by user3718986
Question is,
It takes me 3 hours to fly from NY to CA. How much it will take me if I fly directly from NY to Florida. suppose that distance from CA to Flordia is 8 hours by air..Rule is if you suppose to travel from NY to Florida you will have to pass through CA.
I did the quesiton in JavaScript below but coding isn't correct. Can someone fixed this issue for me please?
var destination = prompt('Please enter your destinations. We are currently flying to NY,CA and FL');
var locatioon = prompt("specify your current location. ");
switch (destination) {
case 'NY':
{
distanceTeller(locatioon);
break;
}
break;
case 'CA':
{
distanceTeller(locatioon);
break;
}
break;
case 'FL':
{
alert("11 HR");
}
default:
alert('dont look at me');
break;
}
function distanceTeller(locatioon) {
if (locatioon == 'CA')
{
alert('it will take you 3 hours');
} else if (locatioon == 'FL')
{
alert('it will take you 8 hours');
} else
alert('it will take you 11 hours to reach NY');
}