Q:

Write a JavaScript program that return true if the given value is a number, false otherwise

0

Write a JavaScript program that return true if the given value is a number, false otherwise.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

const validateNumber = n => !isNaN(parseFloat(n)) && isFinite(n) && Number(n) == n;
console.log(validateNumber('200'));
console.log(validateNumber('10'));
console.log(validateNumber('abc'));

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now