Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What this "get" in JavaScript object means?

Tags:

javascript

Look at this script:

var human = 
{
   firstName: 'Saeed',
   lastName: 'Neamati',
   get fullName() {
       return this.firstName + ' ' + this.lastName;
   }
}

I don't know what get means in this context.

like image 793
Saeed Neamati Avatar asked Sep 13 '11 11:09

Saeed Neamati


1 Answers

It identifies an object property that's returned when the property is read.

See https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special/get

like image 156
Alex K. Avatar answered Nov 02 '22 11:11

Alex K.