Object Property Accessors ?

Object Property Accessors provide access to an object’s properties by using the dot notation or the bracket notation.

There are two ways to access a property of an object:
• Using square bracket notation, for example person[‘occupation’]
• Using the dot notation, for example person.occupation

Let’s take this object:

var person  = {
  name: 'dileep',
  occupation: 'programmer'

Accessing a property with the dot notation:


Accessing a property with the bracket notation:


Accessing a non-existing property returns undefined :

 'Hair color is ' + hero.hair_color;
 "Hair color is undefined"

More Info : Properties Accessors


My Name is Dileep Singh, Noder, Javascript Lover & NoSql Developer, Fitness Freak, Love to travel new places, learning photography & Music Manic ♯ ♩ ♬

Posted in Javascript Tagged with: