-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjson.html
More file actions
53 lines (48 loc) · 1.06 KB
/
json.html
File metadata and controls
53 lines (48 loc) · 1.06 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var json = {
"name":"小米",
"age":"10",
"sex":"女"
};
for (var key in json){
console.log(key + ":" + json[key]);
}
// function Ff(name, age) {
// this.name = name;
// this.age = age;
// this.s = function () {
// console.log(this.name + this.age);
// }
// }
// var s1 = new Ff('1', 2);
//
// function deep(obj) {
// var newobj = obj.constructor === Array ? []:{};
// if (typeof obj !== 'object'){
// return;
// }else {
// for (var i in obj) {
// if (obj.hasOwnProperty(i)){
// newobj[i] = typeof obj[i] === 'object'?deep(obj[i]):obj[i];
// }
// }
// }
// return newobj;
// }
//
// var s2 = deep(s1);
// s1.s();
// s2.s();
// s1.name = "s1";
// s1.s();
// s2.s();
</script>
</body>
</html>