If I understood it correctly, the callback to setTimeout is called with the global object as its context (like, 500ms later, it’s called like a normal function, and this is thus bound to the global object, which has no type variable. If it doesn’t make sense try declaring var type = 'hello'; at the top of the code)
function globalFunction(fn, delay){
console.log(this); // javascript will look for the value of "this" and it's the global object
console.log(this.type); // undefined
fn(); // undefined
}
var Computer = function (type) {
this.type = type;
};
Computer.prototype.run = function () {
globalFunction(function() { return this.type }, 500);
}
computer = new Computer('Windows');
computer.run();