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);
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);