var ask= prompt("Please insert number or string);
alert(typeof ask);
i am using above code but it return me only string not number (if i type Number).
what to do if i use below logic then this will also fail becuase now it will return only number
dialog boxes in JavaScript always return string. Use isNaN() to determine, like this:
var ask= prompt("Please insert number or string");
if (isNaN(ask)){
alert("You enter a string");
} else {
alert("You enter a Number");
}
Comments are closed.