So i am trying to get the input from the user straight as my arguments however, when i do that, it gives me an undefined and NaN error... but when i try to hard code the argument with a random number, it works perfectly. here is more of the code:
let input = document.getElementById("input")
const convertBtn = document.getElementById("convert-btn")
let length = document.getElementById("length")
const volume = document.getElementById("volume")
const mass = document.getElementById("mass")
convertBtn.addEventListener("click", function(){
forLength( 20)
forVolume()
forMass()
})
function forLength(input){
let toFeets = Math.floor((input * 3.281)*100)/100
let toMeters = Math.floor((input / 3.281)*100)/100
return length.innerHTML += `<p>${input} meters = ${toFeets} feets | ${input} feet = ${toMeters} meters</p>`
}
function forVolume(input){
let toGallon = Math.floor((input * 0.264)*100)/100
let toLiters = Math.floor((input / 0.264)*100)/100
return volume.innerHTML += `<p>${input} liters = ${toGallon} gallons | ${input} gallons = ${toLiters} liters</p>`
}
function forMass(input){
let toPounds = Math.floor((input * 2.204)*100)/100
let toKilos = Math.floor((input / 2.204)*100)/100
return mass.innerHTML += `<p>${input} kilos = ${toPounds} punds | ${input} punds = ${toKilos} kilos</p>`
}
