标签:find 输出 var include cti asc ++ 返回 数组
var arr = [1, 2, 2, 3, 4]
var includes = arr.includes(2)
var map = arr.map(function (item) {
return ++item
})
var reduce = arr.reduce(function (prev, next) {
return prev + next
})
var some = arr.some(function (item) {
return item === 4
})
var find = arr.find(function (item) {
return item === 4
})
var findIndex = arr.findIndex(function (item) {
return item === 2
})
console.log(include, map, reduce, some, find, findIndex)
//true [ 2, 3, 3, 4, 5 ] 12 true 4 1
标签:find 输出 var include cti asc ++ 返回 数组
原文地址:https://www.cnblogs.com/yangtongBlog/p/9860694.html