-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
54 lines (49 loc) · 1009 Bytes
/
index.html
File metadata and controls
54 lines (49 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<script type="text/javascript">
var myobj = {
num: 1,
arr: [1, 2, 3],
obj: {
test: {
a: 1
},
testbb: {
arr1: [2, 3, 4]
}
}
}
var a = myobj;
a.num = 2;
console.log(a)
console.log(myobj)
// function clone(obj) {
// var result = {}, b;
// // if((b = (obj instanceof Array)) || obj instanceof Object){
// // result = b?[]:{};
// // for(var ket in obj){
// // if(obj[ket] instanceof Array || obj[ket] instanceof Object){
// // result[ket] = clone(obj[ket]);
// // }else{
// // result[ket] = obj[ket];
// // }
// // }
// // }
// for(var ket in obj) {
// result[ket] = obj[ket];
// }
// return result;
// }
//
// var result = clone(myobj);
// result.obj.test.a = 2;
// console.log(result);
// console.log(myobj);
</script>
</body>
</html>