【发布时间】:2020-09-07 18:39:36
【问题描述】:
var A = $(this).attr("id") //result is a string
var B = $(this).attr("id") //result is another string from a different id
var C = {
A: B //I want to use A as Property and B as Value
};
当console.log(C) 被创建时,JS 控制台说 A 是未定义的。为什么会这样?
//如何在变量 C 中使用 A 作为属性,将 B 作为值作为对象,然后用于 Javascript 和 jQuery? //谢谢。
【问题讨论】:
标签: javascript jquery object variables properties