Q.16
Define non-primitive data types.
We know that primitive data types can store only a single value. However, for storing multiple and complex values, we have to use non-primitive data types.
The non-primitive data types are:
1. Object
The Object is a non-primitive data type that is used for storing collections of data. An object contains properties, defined as a key-value pair. A property key (name) is always a string, but the value can be any data type, such as strings, numbers, Booleans, or complex data types like arrays, functions, and other objects.
2. Array
The Array data type is used for representing a group of similar values. Every value in an array has a numeric position, called its index, and it may contain data of any data type-numbers, strings, Booleans, functions, objects, and even other arrays. The array index starts from 0 so that the first array element is arr[0], not arr[1].