I am trying to understand JavaScript this better.
function foo() { console.log(this); } // normal function call foo(); // `this` will refer to `window`
var that = this; function foo(that){ console.log(that): } foo();
foo() parameter is missing.
foo()
so function foo(that) will be undefined.
function foo(that)
undefined
To make it work
foo(that)