in JavaScript by
Q:
What does the isNaN() function?

1 Answer

0 votes
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 and answers

0 votes
asked Mar 23, 2021 in JavaScript by sharadyadav1986
0 votes
asked Mar 20, 2021 in JavaScript by sharadyadav1986
0 votes
asked Jun 9 in JavaScript by sharadyadav1986
...