var vehicleName = 'Toyota';
vehicle.printVehicleNameInner();
var vehicle = {
vehicleName: 'Nissan',
printVehicleNameInner : function () {
console.log("1. "+this.vehicleName);
return function (){
console.log("2. "+this.vehicleName);
}
}
};
var execute = vehicle.printVehicleNameInner();
//execute(); // Output 1.Nissan 2.Toyota
//execute.call(vehicle); //Output 1.Nissan 2.Nissan
//execute.bind(vehicle); //Output 1.Nissan
var exe = vehicle.printVehicleNameInner().bind(vehicle);
exe(); //Output 1.Nissan 2.Nissan