JSFiddle - React, Tailwind, and code Playground

by jasonvee

JavaScript

// https://tinyurl.com/y39whrkl

// get user inputs (which are strings by default)
currency = prompt('Enter the name of the currency: ');
exchangeRate = prompt('Enter the exchange rate: ');
australianDollars = prompt('How many Australia Dollars do you want to convert? : ');

//check data types of each variable
document.write( typeof(currency) + "<br>" );
document.write( typeof(exchangeRate) + "<br>" );
document.write( typeof(australianDollars) + "<br>" );


// do calculation
calculate = australianDollars * exchangeRate
document.write(typeof(calculate) + "<br>");



//concatenate output
document.write(australianDollars + ' Australian dollars will give you ' + calculate + ' ' + currency);