function clean(x) { // eslint-disable-next-line use-isnan if (x === Number.NaN) { // Can never be true return null; } if (isNaN(x)) { return 0; } } console.log(clean(Number.NaN)); // Expected output: 0