In the following code example:
'use strict';
function hello(name) {
console.log(this);
}
hello('Annie');
// undefined
let o = {
hello() {console.log(this);}
}
o.hello('Annie');
Why does a function have no this
context when it's placed by itself, but it does when it is placed within an object?