0 votes
in JavaScript by
What does the isNaN() function?

1 Answer

0 votes
by
edited by

The isNan() function returns true if the variable value is not a number. For example:

  1. function number(num) {  
  2.   if (isNaN(num)) {  
  3.     return "Not a Number";  
  4.   }  
  5.   return "Number";  
  6. }  
  7. console.log(number('1000F'));  
  8. // expected output: "Not a Number"  
  9.   
  10. console.log(number('1000'));  
  11. // expected output: "Number"  

Related questions

0 votes
asked Dec 1, 2022 in JavaScript by john ganales
0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986
...