1 | User-defined Methods |
2 | 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" ); } |
3 | Note: The last argument of the Function constructor is implicitly the method body |