I am new to learning javascript. so ,i made simple html with just header file and linked simple javascript code file to it with this code. alert pop is displaying once but not second time.
var pounds = prompt("Enter your weight in Pounds");
var kg = 0.456 * pounds;
Alert("Your weight is:" +"kg");
Your issue is simply a typo. In Javascript, all identifiers are case sensitive, so Alert()
is not the same thing as alert()
. (MDN link)
You're looking for alert()
here:
var pounds = prompt("Enter your weight in Pounds");
var kg = 0.456 * pounds;
alert("Your weight is:" + "kg");