Basic JavaScript Question:

Download Job Interview Questions and Answers PDF

How to test for bad numbers using JavaScript?

JavaScript Interview Question
JavaScript Interview Question

Answer:

The global method, "isNaN()" can tell us about value if a number has gone bad in JavaScript.

var temperature = parseFloat(myTemperatureWidget.value);

if(!isNaN(temperature)) {
alert("Please enter a valid temperature.");
}

Download JavaScript Interview Questions And Answers PDF

Previous QuestionNext Question
How to convert numbers to strings using JavaScript? What's Math Constants and Functions using JavaScript?