User-defined Methods |
Methods are defined as Function objects: function Circle( r ) { this.r = ( r > 0 ) ? r : 0; this.getRadius = new Function( "return this.r" ); this.setRadius = new Function( "r", "this.r = r" ); } |
Note: The last argument of the Function constructor is implicitly the method body |