Advertisement
Guest User

Untitled

a guest
Jun 29th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 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>JS Bin</title>
  7. </head>
  8. <body>
  9.  
  10. <script id="jsbin-javascript">
  11. // new Binding
  12.  
  13. var Animal = function(color, name, type) {
  14. this.color = color;
  15. this.name = name;
  16. this.type = type;
  17. }
  18.  
  19. var zebra = new Animal("black and white stripe", "mr z", "mammal");
  20.  
  21. console.log(zebra);
  22.  
  23.  
  24.  
  25. // Windows binding
  26. var sayAge = function() {
  27. console.log(this.age);
  28. };
  29.  
  30. var me = {
  31. age: 25
  32. };
  33.  
  34. sayAge();
  35. window.age = 35;
  36. sayAge();
  37. </script>
  38.  
  39.  
  40.  
  41. <script id="jsbin-source-javascript" type="text/javascript">// new Binding
  42.  
  43. var Animal = function(color, name, type) {
  44. this.color = color;
  45. this.name = name;
  46. this.type = type;
  47. }
  48.  
  49. var zebra = new Animal("black and white stripe", "mr z", "mammal");
  50.  
  51. console.log(zebra);
  52.  
  53.  
  54.  
  55. // Windows binding
  56. var sayAge = function() {
  57. console.log(this.age);
  58. };
  59.  
  60. var me = {
  61. age: 25
  62. };
  63.  
  64. sayAge();
  65. window.age = 35;
  66. sayAge();</script></body>
  67. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement