function sanitise(x) { if (isNaN(x)) { return NaN; } return x; } console.log(sanitise('1')); // Expected output: "1" console.log(sanitise('NotANumber')); // Expected output: NaN