object

What is object ?

  • Profile picture of Mcs
  • by Mcs June 30, 2025

An object in JavaScript is a special data type that allows you to store data in key-value pairs.

How to Define a JavaScript Object

Using an Object Literal
Using the new Keyword
Using an Object Constructor

Syntax :
object

Object Constructor Functions

Sometimes we need to create many objects of the same type.

To create an object type we use an object constructor function.

It is considered good practice to name constructor functions with an upper-case first letter.

Comments

Add new comment

Restricted HTML

  • Allowed HTML tags: <br> <p> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id> <cite> <dl> <dt> <dd> <a hreflang href> <blockquote cite> <ul type> <ol type start> <strong> <em> <code> <li>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.