0

I came across the following JS object declaration:

var myObj = {
  calc: function calc() {
    return 'calc method';
  },
  get name() {
    return 'test name property';
  }
};
myObj.name// -> 'test name property'

I understand what 'calc: ..' is but what is 'get name'? Is this some new syntax for declaring 'get' property? Cannot find it in documentation.

SimonD
  • 1,441
  • 2
  • 18
  • 30

0 Answers0