Objects in javascript

Arunbabu r s
1 min readDec 13, 2020

There is a famous saying we go like this everything in javascript is objects

  • Booleans can be objects (if defined with the new keyword)
  • Numbers can be objects (if defined with the new keyword)
  • Strings can be objects (if defined with the new keyword)
  • Dates are always objects
  • Maths are always objects
  • Regular expressions are always objects
  • Arrays are always objects
  • Functions are always objects
  • Objects are always objects

All JavaScript values, except primitives, are objects.

A primitive value is a value that has no properties or methods.

A primitive data type is a data that has a primitive value.

Objects are variables too. But objects can contain many values.

The values are written as name: value pairs (name and value separated by a colon).The values in objects are called as properties

for eg:

var person = {firstName:”ab”, lastName:”cd”, age:24, eyeColor:”black”};

methods are actions that can be performed on objects.

Object properties can be both primitive values, other objects, and functions.

An object method is an object property containing a function definition.

objects in javascript are mutable