x
1
<p>删除 JSON 对象属性。</p>
2
3
<p id="demo"></p>
4
5
<script>
6
var myObj, i, x = "";
7
myObj = {
8
"name": "mifengjc",
9
"alexa": 10000,
10
"sites": {
11
"site1": "www.mifengjc.com",
12
"site2": "m.mifengjc.com",
13
"site3": "c.mifengjc.com"
14
}
15
}
16
delete myObj.sites.site1;
17
for (i in myObj.sites) {
18
x += myObj.sites[i] + "<br>";
19
}
20
document.getElementById("demo").innerHTML = x;
21
</script>