Respuesta :
Answer:
Explanation:
Like requested the following function is written in JavaScript and prompts the user for a total amount of Kenyan Currency that needs to be converted. It then places that value in a variable and divides it by 115 Ksh so that it gives us the USD value of that currency. Then that value is returned. The function can be attached to any button but it must be done manually when creating the button's onClick method.
function convertCurrency() {
var KenyanAmount = prompt("Please enter the amount of Kenyan you want to convert.");
var usdValue = "$" + (KenyanAmount / 115);
return usdValue;
}
The program is a sequential program, and does not require loops and conditional statements
The function in JavaScript where comments are used to explain each line is as follows:
//This defines the function
function convertCurrency() {
//This gets input for the amount to convert
var Amount = prompt("Kenyan Shillings: ");
//This converts the Kenyan Shillings to US Dollars
var usdValue = KenyanAmount / 115;
//This returns the converted amount to the main method
return usdValue;
}
Read more about JavaScript at:
https://brainly.com/question/9856013