codecamp

JavaScript 使用变量访问对象属性

// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};


// Only change code below this line;


var playerNumber=16; // Change this Line
var player = testObj[playerNumber]; // Change this Line
JavaScript 使用[]读取对象属性
JavaScript 更新对象属性
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定