You need to call somethingwith applyto thisbe properly installed inside something:
function test(){
this.item = 'string';
this.exec = function(){
something.apply(this);
}
function something(){
console.log(this.item);
console.log('string');
}
}
As @aaronfay noted, this is because it thisdoes not reference the object created new test(). You can read about it here , but the general rule is:
object, this object. ( ), this , window.