Skip to content

Commit fc45a9b

Browse files
committed
Clarified 'this' koans
1 parent 9640e29 commit fc45a9b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

topics/about_this.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,25 @@ test("'this' inside a method", function () {
1212

1313
test("'this' on unattached function", function () {
1414
var person = {
15-
handle: 'bob',
15+
name: 'bob',
1616
intro: function () {
17-
return "Hello, my name is " + this.handle;
17+
return "Hello, my name is " + this.name;
1818
}
1919
}
2020

2121
var alias = person.intro;
2222

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

2929
test("'this' set explicitly", function () {
3030
var person = {
31-
handle: 'bob',
31+
name: 'bob',
3232
intro: function () {
33-
return "Hello, my name is " + this.handle;
33+
return "Hello, my name is " + this.name;
3434
}
3535
}
3636

0 commit comments

Comments
 (0)