shradha-khapra / JavaScriptSeries

257 stars 214 forks source link

Issue related to .value #16

Open 662saurav opened 7 months ago

662saurav commented 7 months ago

Can somebody please help me in explaining why these lines of code not working

btn.addEventListener("click", (evt) => { evt.preventDefault();
let amt = document.getElementById("amount"); let amtVal = amt.value;

if(amtVal < 0 || isNaN(amtVal) || amtVal == "") {
    amtVal = "1";

}

});