Reading John Resig's article about Javascript getters and setters I see a structure I'm unfamiliar with in Javascript:
Field.prototype = {
get value(){
return this._value;
},
set value(val){
this._value = val;
}
};
Prototype is an object like many others but the get and set portions here seem unfamiliar. By what name are they referred? They don't look like typical properties of an object (following the "key":"value" syntax) and they don't quite look like standard functions either.
Is this simply syntactic sugar that the JS engine converts into something more recognisable?
Update:
The real crux of my question is: Since { foo(){} } isn't valid syntax, what makes it valid given a get or set operator? { get foo(){} }