let aim = [
{name:'Anne', age: 23, gender:'female'},
{name:'Leila', age: 16, gender:'female'},
{name:'Jay', age: 19, gender:'male'},
{name:'Mark', age: 40, gender:'male'}
]
let result = [];
let nameArr = ['Anne','Jay']
for(let i = 0; i < nameArr.length; i++) {
let aaa = nameArr;
result.push(aim.find(item => item.name = aaa[i]))
}
console.log(result)
想請問要如何讓push的值不是最後一個[Jay,Jay] 而是 ['Anne','Jay']
試過setTimeOut 和 (function) 都沒有成功...