首页 > 代码库 > 16-属性绑定

16-属性绑定

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>

    var stu = new Object();
    var aaa = "age";

    //对象名.属性
    stu.name = "拴柱";
//    stu.aaa = 19;
    //对象名[变量]   对象名[值]
    stu[aaa] = 20;
    stu[0] = "你好";

    console.log(stu);

//    var arr = [1,2,3];
//    arr[0] = 4;


</script>
</body>
</html>

  

16-属性绑定