I need to clarify some terminology, because right now my project has a bit of a mix of terminology when refering to variables.
Consider an object defined like this:
var anObject = {
a: {
value1: 1337,
value2: 69,
value3: "420 man"
}
}
Please correct me if I'm wrong, but I assume a
is a property of the object anObject
.
But in the context of anObject
, how should I refer to value1
? Is it a "property" aswell?
The reason I'm asking is I need to create functions to access "variables within variables" of objects. Like such:
function getProperty(name) {
// ...
}
var theValueImLookingFor = getProperty("a.value1");
If this questions is inappropriate for Stack Overflow, please let me know where I should as this question instead. Thanks
EDIT: I'm not asking how to access the nested variable, I'm asking how to refer to it in terminology.
Given that value1
is a property of a
which is a property of anObject
. What is value1
to anObject
? Is it a "property-property"? I don't mean to sound flippant but what do I call it?