Convenient method to find one item in an array, avoid writing and for + if:
let arys = [1,,5,,6] ;
let target = 6;
let res = arys.find(item => item === target);
console.log(res);
2023-09-23 14:54:03
Convenient method to find one item in an array, avoid writing and for + if:
let arys = [1,,5,,6] ;
let target = 6;
let res = arys.find(item => item === target);
console.log(res);