JS对象之寻址方式
程序员文章站
2022-10-31 16:35:21
js对象之寻址方式
var person={
firstname : "bill",
lastname : "gates",
id...
js对象之寻址方式
var person={ firstname : "bill", lastname : "gates", id : 5566 };
寻址方式:
name=person.lastname; name=person["lastname"];
例如:
<script> var person={ firstname : "bill", lastname : "gates", id : 5566 }; document.write(person.lastname + "
"); document.write(person["lastname"] + "
"); </script>
结果:
gates
gates