There are different ways to create new objects:
- Define and create a single object, using an object literal.
- Define and create a single object, with the keyword new .
- Define an object constructor, and then create objects of the constructed type.
How do you create objects?
Creating an Object
- Declaration − A variable declaration with a variable name with an object type.
- Instantiation − The ‘new’ keyword is used to create the object.
- Initialization − The ‘new’ keyword is followed by a call to a constructor. This call initializes the new object.
A set is a collection of items which are unique i.e no element can be repeated. … Set in ES6 are ordered: elements of the set can be iterated in the insertion order. Set can store any types of values whether primitive or objects.