回答編集履歴
1
chousei
test
CHANGED
@@ -33,3 +33,33 @@
|
|
33
33
|
console.dir(listMember);//listMemberに影響はない
|
34
34
|
|
35
35
|
```
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
# 再確認用
|
40
|
+
|
41
|
+
```javascript
|
42
|
+
|
43
|
+
const listMember = [
|
44
|
+
|
45
|
+
{ title: '1' },
|
46
|
+
|
47
|
+
{ title: '2' },
|
48
|
+
|
49
|
+
{ title: '3' },
|
50
|
+
|
51
|
+
];
|
52
|
+
|
53
|
+
const l1=listMember[0];
|
54
|
+
|
55
|
+
const l2=JSON.parse(JSON.stringify(listMember));
|
56
|
+
|
57
|
+
l1.title="100";
|
58
|
+
|
59
|
+
console.dir(listMember);//listMemberにさかのぼって変更
|
60
|
+
|
61
|
+
l2[1].title="200";
|
62
|
+
|
63
|
+
console.dir(l2);//listMemberに影響はない
|
64
|
+
|
65
|
+
```
|