就是最近用到了 這個方法,突然覺得很優(yōu)雅,所以記錄下
比如說 驗證一個數(shù)組里面 有么有 為空項,要是有的話,會返回 false
const isBelowThreshold = (currentValue) => currentValue.trim() !== '';
const array1 = ['11',' '];
console.log(array1.every(isBelowThreshold)); // false
記錄一下
相關文檔:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every