Conteúdo do Curso
JavaScript Data Structures
JavaScript Data Structures
Nested Properties
Objects are not limited to holding simple key-value pairs. They can also store nested and grouped data, particularly useful for organizing complex information.
Nested Properties
Imagine you want to represent the computer information, including the processor, memory, storage, and owner data, specifying the name and username. Storing this data as an object with nested properties is most convenient. Let's see an example:
In this example, the computer
object has four primary properties: brand
, model
, specifications
, and owner
.
What makes this structure powerful is the fact that the specifications
and owner
properties are themselves objects. This allows you to organize related data hierarchically.
Obrigado pelo seu feedback!