Objects and its Internal representation

Sarveshlal
1 min readDec 3, 2020

Objects are more complex and each object may contain any combination of these primitive data-types as well as reference data-types. An object, is a reference data type. Variables that are assigned a reference value are given a reference or a pointer to that value. That reference or pointer points to the location in memory where the object is stored. The variables don’t actually store the value.

Object Creation

We can create objects in many ways in JavaScript, let’s look at each one of them.

  1. Object literal — Object literals are a comma-separated list of key-value pairs wrapped in curly braces. Object literal property values can be of any data type, including array literals, functions, nested object literals or primitive data type.
  2. object.create()— the method creates a new object with the specified prototype and properties of the old object.
    syntax — Object.create(prototype[, propertiesObject])
  3. object instance— The use of object constructor in conjunction with the “new” keyword allows us to initialize new objects.
    Example:
    var newObj = new Object();
    newObj.name = ‘abc’;
    newObj.location = ‘India’;

--

--