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 () {
1212
1313test ( "'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
2929test ( "'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
You can’t perform that action at this time.
0 commit comments