Currently, my project is using inconsistent terminology when referring to variables, and I need to clarify this issue.
Let's take an object defined in this way:
var anObject = {
a: {
value1: 1337,
value2: 69,
value3: "420 man"
}
}
I believe that a
is a property of the object anObject
. But within the context of anObject
, how should we describe value1
? Is it also considered a "property"?
The reason behind this question is that I am looking to create functions for accessing nested variables within objects. For example:
function getProperty(name) {
// ...
}
var desiredValue = getProperty("a.value1");
If this inquiry is not suitable for Stack Overflow, please advise on where I can seek assistance. Thank you.
EDIT: My query is not about accessing the nested variable, but rather about the appropriate terminology to use when referring to it.
Given that value1
is a property of a
which is a property of anObject
, what would we call value1
in relation to anObject
? Would it be a "property-property"? I hope this clarifies my question.