我試圖使Node.js的模塊中使用箭頭函數內isNaN
全局函數,但我發現這個錯誤的:ESLint意外請使用isNaN
[eslint] Unexpected use of 'isNaN'. (no-restricted-globals)
這是我的代碼:
const isNumber = value => !isNaN(parseFloat(value));
module.exports = {
isNumber,
};
有什麼想法我做錯了什麼? PS:我正在使用AirBnB風格指南。
哦,真是個小姐!我在mozilla js文檔中搜索,他們使用全局函數。我不知道Number.isNaN()也存在。謝謝! :) –
我提出了答案,但我是Airbnb投票的理由。 – mwilcox