题解 | #查找元素位置#
查找元素位置
http://www.nowcoder.com/practice/0a9af9cb20c34babb6232126e019c74d
function findAllOccurrences(arr, target) {
let a = []
arr.forEach((item, index) => {
if(item == target) a.push(index)
})
return a
}查找元素位置
http://www.nowcoder.com/practice/0a9af9cb20c34babb6232126e019c74d
function findAllOccurrences(arr, target) {
let a = []
arr.forEach((item, index) => {
if(item == target) a.push(index)
})
return a
}相关推荐
_世界和平:可以偷偷吃肉,但是不要在饥饿的人面前一边吃肉一边吧唧嘴还嫌肉不好吃
查看1道真题和解析