What is a composite data type i.e. object in JavaScript?

JavascriptWeb DevelopmentFront End Technology

A composite data type in JavaScript has multiple values, which grouped together. It works the same as the object in the class.

The object and array are composite data types. Let’s learn about the object. An object is considered as properties of objects and functions associated with the object. The following is the dot notation −


As you can see above, properties and methods are denoted using dot notation. The notation begins with object name (dept) and ends with property name (dept_id).

Object properties can be any of the three primitive data types, or any of the abstract data types, such as another object. Object properties are usually variables that are used internally in the object's methods but can also be globally visible variables that are used throughout the page.

The syntax for adding a property to an object is −

objectName.objectProperty = propertyValue;
Published on 23-Jan-2018 12:40:09