File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -12,25 +12,25 @@ test("'this' inside a method", function () {
12
12
13
13
test ( "'this' on unattached function" , function ( ) {
14
14
var person = {
15
- handle : 'bob' ,
15
+ name : 'bob' ,
16
16
intro : function ( ) {
17
- return "Hello, my name is " + this . handle ;
17
+ return "Hello, my name is " + this . name ;
18
18
}
19
19
}
20
20
21
21
var alias = person . intro ;
22
22
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
24
24
// (window in a browser)
25
25
window . __ = 'Peter' ;
26
26
equals ( "Hello, my name is Peter" , alias ( ) ) ;
27
27
} ) ;
28
28
29
29
test ( "'this' set explicitly" , function ( ) {
30
30
var person = {
31
- handle : 'bob' ,
31
+ name : 'bob' ,
32
32
intro : function ( ) {
33
- return "Hello, my name is " + this . handle ;
33
+ return "Hello, my name is " + this . name ;
34
34
}
35
35
}
36
36
You can’t perform that action at this time.
0 commit comments