repl.txt (706B)
1 2 {{alias}}( obj, prop, getter, setter ) 3 Defines a property having read-write accessors. 4 5 Read-write accessors are enumerable and non-configurable. 6 7 Parameters 8 ---------- 9 obj: Object 10 Object on which to define the property. 11 12 prop: string|symbol 13 Property name. 14 15 getter: Function 16 Get accessor. 17 18 setter: Function 19 Set accessor. 20 21 Examples 22 -------- 23 > var obj = {}; 24 > var name = 'bar'; 25 > function getter() { return name + ' foo'; }; 26 > function setter( v ) { name = v; }; 27 > {{alias}}( obj, 'foo', getter, setter ); 28 > obj.foo 29 'bar foo' 30 > obj.foo = 'beep'; 31 > obj.foo 32 'beep foo' 33 34 See Also 35 -------- 36