Home > front end >  JS to obtain variable variable name?
JS to obtain variable variable name?

Time:09-23

As title, JS or JQuery, access to variable variable name?

CodePudding user response:

I ask you a question can borrow floor post point for a long time, has been null, mobile phone almost no traffic

CodePudding user response:

Tell you the specific needs of
Variable access this would require the variable name, access to the variable will already know the variable name, do not need to obtain

CodePudding user response:

Is, of course, can make a framework

CodePudding user response:

 
//you should say is attribute
Let data={
https://bbs.csdn.net/topics/Key1: 'value1',
Key2: 'value2'
}

In data) for (let k {
The console. The log (' attributes: '+ k)
The console. The log (' attribute values: '+ data [k])
}

CodePudding user response:

 
Let data={
https://bbs.csdn.net/topics/Key1: 'value1',
Key2: 'value2'
}
Object. The keys (data);
  • Related