赞
踩
- let arr = [1, 2, 3, 4, 5];
- let index = arr.indexOf(3); // 返回 2
- let arr = [1, 2, 3, 4, 5];
- let isIncluded = arr.includes(3); // 返回 true
- let arr = [{name: "Tom", age: 18}, {name: "Jerry", age: 20}];
- let person = arr.find(item => item.age === 20); // 返回 {name: "Jerry", age: 20}
- let arr = [{name: "Tom", age: 18}, {name: "Jerry", age: 20}];
- let index = arr.findIndex(item => item.age === 20); // 返回 1
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。