DEV Community

Arul .A
Arul .A

Posted on

What is Object?

  • object contains information & methods. It is also defines key-value pairs.

  • when you use function in object only use inside the object, because when you call function using key .

  • An object is a variable that can hold multiple variables.

Example:

const pen ={
brand : "cello",
colour :"red",
price :"10",
type  : "gel",
write : function (){
        console.log("writing")
        }
}
console.log(pen.brand)
pen.write()


Enter fullscreen mode Exit fullscreen mode

Top comments (0)