Way2tutorial Snippet Editor
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>JavaScript object properties and method</title> </head> <body> <pre> <!-- Use pre element for work document.writeln() method --> <script type="text/javascript"> var employee= { name: "Opal Kole", salary: function() { this.salary= 15000; this.allowance = 1300; }, information: function() { document.writeln("Employee name: " + employee.name); document.writeln("Employee Salary: " + this.salary); document.writeln("Employee Allowance: " + this.allowance ); } } employee.salary() employee.information() </script> </pre> </body> </html>