简体   繁体   中英

Are these subproperties? What is the correct term?

I have a question over terminology. In JavaScript, I have an array made up of properties that are themselves objects, delimited by braces. Would the properties of the object properties of the array object be the array's subproperties? Is there a specific term for this?

Here's an example:

 var arrayObject = [
      {subproperty1: ["value1", "value2", "value3"], subproperty2: value}, 
      {subproperty1: ["value4", "value5", "value6"], subproperty2: value},
      {subproperty1: ["value7", "value8", "value9"], subproperty2: value},
 ];

If I use the Object.keys function to get the property names of arrayObject, the property names are the index values--0, 1, 2.

 console.log(Object.keys(arrayObject)); // ["0", "1", "2"]

Would the properties of the objects 0, 1, and 2 that are the properties of arrayObject be defined as the subproperties of arrayObject? I just want to be terminologically accurate.

not really. also I would not say that an array is made up of properties but contains elements . Objects have properties, arrays have elements.

subproperty as a term sounds strange. I don't think there is a term for what you want, also consider that theese objects may have properties that are other objects.

I would describe your structure as an array with elements where each element has the properties subproperty1 and subproperty1 .

Also consider that not every object in an array must have the same properties.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM