1 <!DOCTYPE html> 2 <html> 3 <head lang="en"> 4 <meta charset="UTF-8"> 5 <title></title> 6 </head> 7 <body> 8 <script> 9 10 var stu = new Object(); 11 var aaa = "age"; 12 13 //对象名.属性 14 stu.name = "拴柱"; 15 // stu.aaa = 19; 16 //对象名[变量] 对象名[值] 17 stu[aaa] = 20; 18 stu[0] = "你好"; 19 20 console.log(stu); 21 22 // var arr = [1,2,3]; 23 // arr[0] = 4; 24 25 26 </script> 27 </body> 28 </html>