isNaN

const element = document.getElementById(‘myBtn’); element.addEventListener(‘click’, myFunction);
function myFunction() { const nan = document.getElementById(‘is-nan’).value; document.getElementById(‘nan-result’).innerHTML = isNaN(nan)

isNaN method returns true if a value is Not-a-Numner

Example


Similar Posts

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *