How to check if a variable is a number include value in string with JavaScript

1 Answer

0 votes
function isNumeric(num) {
    return !isNaN(num); 
}

console.log(isNumeric('234')); 

console.log(isNumeric('35F')); 

console.log(isNumeric(98));

console.log(isNumeric('javascript')) 
 
 
 
  
/*
run:
        
true
false
true
false
      
*/

 



answered Jun 11, 2021 by avibootz

Related questions

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