Object construct

The Object construct creates an object containing keys and their corresponding values.

Syntax

javascriptlet object = new Object(object elements separated by commas);
javascriptlet object = {object elements separated by commas}

Example

Let's create a new object:

javascriptlet object = new Object({'a': 1, 'b': 2, 'c': 3});
console.log(object);

The code execution result:

javascript{'a': 1, 'b': 2, 'c': 3}

See also

  • the Array construct
    that creates a new array