{"id":605,"hash":"ec7221423e544612a569db49f787a6481436313b45e7d1d3bbe2df6248f0dc20","pattern":"ESLint Unexpected use of isNaN","full_message":"I'm trying to use the isNaN global function inside an arrow function in a Node.js module but I'm getting this error:\n\n[eslint] Unexpected use of 'isNaN'. (no-restricted-globals)\n\nThis is my code:\n\nconst isNumber = value => !isNaN(parseFloat(value));\n\nmodule.exports = {\n  isNumber,\n};\n\nAny idea on what am I doing wrong?\n\nPS: I'm using the AirBnB style guide.","ecosystem":"npm","package_name":"eslint","package_version":null,"solution":"As the documentation suggests, use Number.isNaN.\n\nconst isNumber = value => !Number.isNaN(Number(value));\n\nQuoting Airbnb's documentation:\n\n  Why? The global isNaN coerces non-numbers to numbers, returning true\n  for anything that coerces to NaN. If this behavior is desired, make it\n  explicit.\n\n// bad\nisNaN('1.2'); // false\nisNaN('1.2.3'); // true\n\n// good\nNumber.isNaN('1.2.3'); // false\nNumber.isNaN(Number('1.2.3')); // true","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/46677774/eslint-unexpected-use-of-isnan","votes":197,"created_at":"2026-04-19T04:51:24.116077+00:00","updated_at":"2026-04-19T04:51:24.116077+00:00"}