typeof to check if a value is classified as a number primitive.NaN, check if val === val (as NaN has a typeof equal to number and is the only value not equal to itself).const isNumber = val => typeof val === 'number' && val === val;
isNumber(1); // true
isNumber('1'); // false
isNumber(NaN); // falseSubscribe to get resources directly to your inbox. You won't receive any spam! ✌️