How to check if a variable is a number in JavaScript

1 Answer

0 votes
function isNumeric(num) {
    return Number.isInteger(num);
}
 
console.log(isNumeric('234')); 
 
console.log(isNumeric('35F')); 
 
console.log(isNumeric(98));
 
console.log(isNumeric('javascript')) 
  
  
  
   
/*
run:
         
false
false
true
false
       
*/

 



answered Jun 12, 2021 by avibootz

Related questions

1 answer 138 views
1 answer 146 views
1 answer 207 views
2 answers 223 views
...