1. 程式人生 > >JS——屬性綁定

JS——屬性綁定

new pan span object strong var ons nbsp spa

1、普通形式

<script>
    var stu = new Object();
    stu.name = "ww";
    console.log(stu);//{name: "ww"}
</script>

2、特殊形式:數字或者變量

<script>
    var stu = new Object();
    stu.name = "ww";
    var aaa = "age";
    stu[aaa] = 19;
    stu[0] = "男";
    console.log(stu);//{0: "男", name: "ww", age: 19}
</script>

JS——屬性綁定