JavaScript/array/find
来自康健生活
< JavaScript | array
引言
other
find 方法会更改引用
const source = [1,2,3];
const target = source.find(_ => _ === 1);
source[0] = 4;
console.log(source);
console.log(target);
[4, 2, 3] 1
No categories
find 方法会更改引用
const source = [1,2,3];
const target = source.find(_ => _ === 1);
source[0] = 4;
console.log(source);
console.log(target);
[4, 2, 3] 1
No categories