JavaScript中的对象是什么,可以访问任何属性?**
访问对象的属性
没有对象,就没有JavaScript。布尔值,数字,函数等所有内容都是对象。访问对象的属性在以下方法中进行了说明。
示例1
<html>
<body>
<script>
myObj = {"name":"Ramesh","age":30,"family":
[{"mother":"Geetha","father":"Rao"}],"city":"Berlin"};
var res = myObj.family[0].mother;
document.write(res);
</script>
</body>
</html>输出结果
Geetha
示例2
<html>
<body>
<script>
myObj = {"name":"Ramesh","age":30,"family":
[{"mother":"Geetha","father":"Rao"}],"city":"Berlin"};
var res = myObj.city;
document.write(res);
</script>
</body>
</html>输出结果
Berlin
热门推荐
5 怎么说祝福语简短
7 初八祝福语简短语
10 婶婶生日贺词简短祝福语
11 直播生孩子祝福语简短
12 早晨好正能量祝福语简短
13 奶奶生日感恩祝福语简短
14 跨年的生日祝福语简短
15 给侄子祝福语简短精辟
16 青春告白祖国简短祝福语
17 股市祝福语简短10字
18 中秋快乐祝福语简短的