Interview icon indicating copy to clipboard operation
Interview copied to clipboard

Day369:js数组some()和every()方法的区别及自己去实现这两个方法?

Open qappleh opened this issue 4 years ago • 1 comments

qappleh avatar Apr 22 '21 03:04 qappleh

共同点: 1.每一项的遍历数组

2.三个参数相同

3.返回的值都是布尔值

区别: 1.some()方法,遍历数组中的每一项,若其中一项为true,则返回值是true

2.every()方法,遍历数组每一项,若全部为true,才返回true ,否则返回false

qappleh avatar Sep 06 '21 08:09 qappleh