I passed the following object:
var myVar = { typeA: { option1: "one", option2: "two" } }
I want to be able to pull out the key typeA
from the above structure.
This value can change each time so next time it could be typeB
.
So I would like to know if there is a way for me to do something like the following pseudo code:
var theTypeIs = myVar.key();
This way when I can pass this object and I can pull out the first value of the object, in this case it is typeA
and then based on that I can do different things with option1
and option2
.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…