标签: javascript typescript
如果我有:
var key = "Section"; course.key = "101";
我被告知course.key is unidentified。我试图设置course.Section = "101"。无论如何都要在第二行传递键值?
course.key is unidentified
course.Section = "101"
答案 0 :(得分:0)
key的属性course未定义。使用括号表示法。
key
course
course[key] = "101"
与
course["Section"] = "101"