Javascript examples for Object:Object Method
Create object and method
<html> <head> <script type="text/javascript"> function hex(x,y,side,isLast,color)//constructor. { this.x = x;/*from w ww . jav a2 s. c om*/ this.y = y; this.side = side; this.isLast = isLast; this.color = color; function multiply() { return this.x * this.y; } this.multiply = multiply; } var hexagon = new hex(22,22,20,0,1); document.write(hexagon.multiply) </script> </head> <body> <!--Content here--> </body> </html>