robertsosinski / tutorial-scope-in-javascript

Code to accompany my "Binding Scope in JavaScript" tutorial

This URL has Read+Write access

tutorial-scope-in-javascript / example-2.js
100644 15 lines (10 sloc) 0.197 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// example-2.js
 
window.name = "window";
 
object = {
  name: "object",
  
  action: function(greeting) {
    console.log(greeting + " " + this.name);
  }
}
 
object.action("hello");
 
// hello object