Skip to content

Commit 2fe1fb2

Browse files
committed
about_this
1 parent cb7190d commit 2fe1fb2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

topics/about_this.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test("'this' inside a method", function () {
44
var person = {
55
name: 'bob',
66
intro: function () {
7-
return "Hello, my name is " + this.__;
7+
return "Hello, my name is " + this.name;
88
}
99
}
1010
equals(person.intro(), "Hello, my name is bob");
@@ -22,7 +22,7 @@ test("'this' on unattached function", function () {
2222

2323
// if the function is not called as an object property 'this' is the global context
2424
// (window in a browser)
25-
window.__ = 'Peter';
25+
window.name = 'Peter';
2626
equals("Hello, my name is Peter", alias());
2727
});
2828

@@ -35,7 +35,7 @@ test("'this' set explicitly", function () {
3535
}
3636

3737
// calling a function with 'call' lets us assign 'this' explicitly
38-
var message = person.intro.call({__: "Frank"});
38+
var message = person.intro.call({window.name: "Frank"});
3939
equals(message, "Hello, my name is Frank");
4040
});
4141

0 commit comments

Comments
 (0)