3 ms·
The first call is to User.getCount() - 'this' refers to User, so the function returns 1. The second call is to a bare function - or more exactly, a function on
by gefh 11y ago
The first call is to User.getCount() - 'this' refers to User, so the function returns 1.
The second call is to a bare function - or more exactly, a function on the global scope - so 'this' refers to the global object, which is window in a browser. So it returns undefined, as there is no window.count.