How can i extract the inner id? I know that it's possible to change the fat arrow function to standart function or instead of this.id
to use obj.id
.
But is there any other way to get the inner id while using the fat arrow function?
var obj = {
id: 1,
cool: () => {
console.log( this.id );
}
};
var id = 2;
obj.cool(); // 2