Javascript examples for Language Basics:Introduction
Adding a New Method to an Object
<!DOCTYPE HTML> <html> <head> <title>Example</title> </head> <body> <script type="text/javascript"> var myData = {// w w w. j av a 2s .com name: "java2s.com", topic: "CSS", }; myData.sayHello = function() { document.writeln("Hello"); }; </script> </body> </html>