Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Methods Reference > Custom Methods > How a Function Is Assigned to an ObjectAn object can contain a function and variables. A function assigned to an object is a method of that object. A method uses the this operator to reference a method variable. The following example is a method that computes the area of a rectangle: function rectangle_area() Siebel CRM passes no arguments to this function, so it is meaningless unless an object calls it. This object provides values for this.width and this.height. The following code assigns a method to an object: The function now uses the values for height and width that were defined when you created the joe rectangle object. To assign a method in a constructor function, you can use the this keyword. The following example creates an object class named Rectangle that includes the rectangle_area method as a property: function rectangle_area() The method is available to any instance of the class. The following example sets the value of area1 to 12 and the value of area2 to 15: var joe = Rectangle(3,4); |
Siebel eScript Language Reference | Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |