JS中every()和some()的用法

every()與some()方法都是JS中數組的迭代方法。web every()是對數組中每一項運行給定函數,若是該函數對每一項返回true,則返回true。 some()是對數組中每一項運行給定函數,若是該函數對任一項返回true,則返回true。 var arr = [ 1, 2, 3, 4, 5, 6 ]; console.log( arr.some( function( item, i
相關文章
相關標籤/搜索