I've come across an object written like this:
var box = {
locked: true,
unlock: function () { this.locked = false; },
lock: function () { this.locked = true; },
_content: [],
get content() {
if (this.locked) throw new Error("Locked!");
return this._content;
}
};
I've never seen 'get content()' before. What does this represent? Is there a key in there somewhere? Or is 'get' a keyword that performs some action on the proceeding block of code? Thanks!