im trying to built a Multiconverter in javascript, but for some reason i can´t stop the loop, and i can´t get the result for the functions. i did the following:
// conversion Dollars to Euros( 1USD = 0.892901) as of 11.08.2019; conversion Swiss Franc to Euro ( 1chf = 0.918063) as of 11-08-2019, conversion Knots to Kph (1knots = 1.85Kph);
//Dollars to Euros
function DollarstoEuros ( Dollars) {
return USD * 0.892901;
}
// Swiss Francs to Euros
function SwissFrancsToEuros ( Francs ) {
return Francs * 0.918063;
}
// Knots to Kph
function KnotstoKph ( Knots ) {
return Knots * 1.85;
}
// Ask the user which conversion they want to use
function WhichConversion () {
var answer = window.prompt( " Welcome to the Mutliconverter! What do you want to convert? ( Dollars, Francs, Knots");
if (answer == "Dollars", "Knots", "Francs"){
return true;
} else {
return false;
}
}
//Ask for a Value
function AskForValue () {
var answer = window.prompt( " Enter a Value to Convert")
return answer;
}
Should i change the function WhichConversion in order to separate the if answer? because the while and the var inside it seems ok to me, maybe or probably it´s a basic mistake, but im in my earlier steps in javascript, and apart of beeing similar, i prefer python.