Javascript examples for Object:Object Method
Call an object method
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <script> function Guy(person_name) {//from w w w.j av a 2 s . com this.name = person_name; this.age = 32; this.say = function() {console.log(this.name + " is " + this.age);}; } var bob = new Guy("Bob"); </script> <a href="#" onclick="bob.say()">eh</a> </body> </html>