Junior — Middle
Which of the built-in data types in JavaScript are considered complex or composite?
sobes.tech AI
Answer from AI
In JavaScript, complex (composite) data types include objects and arrays.
- Objects are collections of key-value pairs, where values can be of any type, including other objects.
- Arrays are ordered lists of values, which are also objects.
Examples:
const obj = { name: "Alice", age: 25 };
const arr = [1, 2, 3, 4];
Unlike simple types (numbers, strings, boolean values, null, undefined, symbols), complex types can contain multiple values and structures.