As the documentation suggests, use Number.isNaN
.
const isNumber = value => !Number.isNaN(Number(value));
Quoting Airbnb’s documentation:
Why? The global isNaN coerces non-numbers to numbers, returning true
for anything that coerces to NaN. If this behavior is desired, make it
explicit.
// bad
isNaN('1.2'); // false
isNaN('1.2.3'); // true
// good
Number.isNaN('1.2.3'); // false
Number.isNaN(Number('1.2.3')); // true