function get () : { }
A getter is a function which is invoked the same way that an ordinary variable or property values is read. Example:
function get x() { return Math.random() } var y = x;(y is assigned a random value)
Getters often appear together with setters, but not always. A getter without a setter works like a read-only variable or property.
Getters can be stand-alone or class-members. They can also be declared as part of an object literal, with a slightly different syntax (no "function"-keyword):
var o = { _value: 1001, get value() { return _value; } }; var p = o.value;
