programming-examples/js/Math/Check whether a variable is numeric or not.js
2019-11-15 12:59:38 +01:00

10 lines
292 B
JavaScript

function is_Numeric(num) {
return !isNaN(parseFloat(num)) && isFinite(num);
}
console.log(is_Numeric(12));
console.log(is_Numeric('abcd'));
console.log(is_Numeric('12'));
console.log(is_Numeric(' '));
console.log(is_Numeric(1.20));
console.log(is_Numeric(-200));