Javascript examples for Object:Object Method
Function Method invocation pattern
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from ww w. j av a 2 s .com*/ var myObject = { value: 0, increment: function (inc) { this.value += inc; return this.value; } }; console.log(myObject.value); var x = myObject.increment(2); console.log(x); } </script> </head> <body> </body> </html>