DEV Community

vishwa v
vishwa v

Posted on • Edited on

Javascript(object)

Intro
Objects are variables that can store both values and functions.

Values are stored as key:value pairs called properties.

Functions are stored as key:function() pairs called methods

Object Example

const car = {
  type: "Fiat",
  model: "500",
  color: "white"
};
Enter fullscreen mode Exit fullscreen mode

An object literal "literally" describes an object using a concise syntax with zero or more key:value pairs inside curly braces to describe all the object properties:

{firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)