Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width">
- <title>Object Reflection in Javascript</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- var Employee = function (firstName, lastName, gender, email)
- {
- this.fisrtName = firstName;
- this.lastName = lastName;
- this.gender = gender;
- this.email = email;
- }
- Employee.prototype.getFullName = function()
- {
- return firstName + " " + lastName;
- }
- Employee.prototype.getEmail = function()
- {
- return this.email;
- }
- Employee.prototype.getGender = function()
- {
- return this.gender;
- }
- var employee = new Employee("Mark", "Matt", "Male", "a@a.com");
- for (var property in employee)
- {
- document.write(property + " : " + employee[property] + "<br/>");
- }
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">var Employee = function (firstName, lastName, gender, email)
- {
- this.fisrtName = firstName;
- this.lastName = lastName;
- this.gender = gender;
- this.email = email;
- }
- Employee.prototype.getFullName = function()
- {
- return firstName + " " + lastName;
- }
- Employee.prototype.getEmail = function()
- {
- return this.email;
- }
- Employee.prototype.getGender = function()
- {
- return this.gender;
- }
- var employee = new Employee("Mark", "Matt", "Male", "a@a.com");
- for (var property in employee)
- {
- document.write(property + " : " + employee[property] + "<br/>");
- }</script></body>
- </html>
Add Comment
Please, Sign In to add comment