var obj = { name: "kuo", age: 25, sex: "boy" }; var arr = ["kuo", 25, "boy"]; console.log(obj); console.log(arr); //取得姓名 console.log(obj.name); console.log(obj["name"]); //工廠模式 var x = "name"; console.log(obj[x]);