且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

检查数组是否包含(仅)数字值

更新时间:2022-03-31 07:00:16

最短的解决方案,当且仅当每一项都是(可强制)数字时,才评估为true:

Shortest solution, evals to true if and only if every item is (coercible to) a number:

!yourArray.some(isNaN)