Guest User

Untitled

a guest
Feb 20th, 2018
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width">
  6. <title>Object Reflection in Javascript</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. var Employee = function (firstName, lastName, gender, email)
  12. {
  13. this.fisrtName = firstName;
  14. this.lastName = lastName;
  15. this.gender = gender;
  16. this.email = email;
  17. }
  18.  
  19. Employee.prototype.getFullName = function()
  20. {
  21. return firstName + " " + lastName;
  22. }
  23.  
  24. Employee.prototype.getEmail = function()
  25. {
  26. return this.email;
  27. }
  28.  
  29. Employee.prototype.getGender = function()
  30. {
  31. return this.gender;
  32. }
  33.  
  34. var employee = new Employee("Mark", "Matt", "Male", "a@a.com");
  35.  
  36.  
  37. for (var property in employee)
  38. {
  39. document.write(property + " : " + employee[property] + "<br/>");
  40. }
  41. </script>
  42.  
  43.  
  44.  
  45. <script id="jsbin-source-javascript" type="text/javascript">var Employee = function (firstName, lastName, gender, email)
  46. {
  47. this.fisrtName = firstName;
  48. this.lastName = lastName;
  49. this.gender = gender;
  50. this.email = email;
  51. }
  52.  
  53. Employee.prototype.getFullName = function()
  54. {
  55. return firstName + " " + lastName;
  56. }
  57.  
  58. Employee.prototype.getEmail = function()
  59. {
  60. return this.email;
  61. }
  62.  
  63. Employee.prototype.getGender = function()
  64. {
  65. return this.gender;
  66. }
  67.  
  68. var employee = new Employee("Mark", "Matt", "Male", "a@a.com");
  69.  
  70.  
  71. for (var property in employee)
  72. {
  73. document.write(property + " : " + employee[property] + "<br/>");
  74. }</script></body>
  75. </html>
Add Comment
Please, Sign In to add comment