123456789101112131415 |
- const input_number = document.querySelector("#input-number");
- const output = document.querySelector("#output");
- const btn_submit = document.querySelector("#btn-submit");
- function miles_to_km(miles)
- {
- return miles * 1.609344;
- }
- btn_submit.addEventListener("click", (event) => {
- const number = input_number.value;
- const result = miles_to_km(number);
- output.textContent = `Result: ${result}`;
- });
|