Advertisement
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>JS Bin</title>
- </head>
- <body>
- <script id="jsbin-javascript">
- // new Binding
- var Animal = function(color, name, type) {
- this.color = color;
- this.name = name;
- this.type = type;
- }
- var zebra = new Animal("black and white stripe", "mr z", "mammal");
- console.log(zebra);
- // Windows binding
- var sayAge = function() {
- console.log(this.age);
- };
- var me = {
- age: 25
- };
- sayAge();
- window.age = 35;
- sayAge();
- </script>
- <script id="jsbin-source-javascript" type="text/javascript">// new Binding
- var Animal = function(color, name, type) {
- this.color = color;
- this.name = name;
- this.type = type;
- }
- var zebra = new Animal("black and white stripe", "mr z", "mammal");
- console.log(zebra);
- // Windows binding
- var sayAge = function() {
- console.log(this.age);
- };
- var me = {
- age: 25
- };
- sayAge();
- window.age = 35;
- sayAge();</script></body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement