function foo(num) {
	console.log("foo: " + num);

	// keep track of how many times `foo` is called
	this.count++;
}

// Create a property to the function object
foo.count = 0;

var i;

for(i=0; i<10; i++) {
	if(i > 5) {
		foo(i);
	}
}

console.log(foo.count); // 0 which means *this* doesn't refers the function itself
function foo(num) {
	console.log("foo: " + num);

	// keep track of how many times `foo` is called
	this.count++;
}

// Create a property to the function object
foo.count = 0;

var i;

for(i=0; i<10; i++) {
	if(i > 5) {
		// Using *`call(..)`*, we ensure the `*this`* points at the
		// function object *(`foo`)* itself
		foo.call(foo, i);
	}
}

console.log(foo.count); // 4
function foo() {
	var a = 2;

	// This magically works and doesn't gives error 
	// but we will explain this in future chapter
	this.bar();
}

function bar() {
	console.log(this.a);
}

foo(); // ReferenceError: a is not defined