Is it possible to deeply self reference within a JS object?
I know it is possible to self reference at the same level, like so:
var foo = {
a: 'bar',
b: 'baz',
c: () => {
return this.a + this.b;
}
};
console.log(foo.c()); // barbaz
I'm just curious if it would be possible to do so from deeper down...
var foo = {
a: 'bar',
b: 'baz',
c: {
ca: 'hello',
cb: () => {
return this.a + this.b;
}
}
};
console.log(foo.c.cb()); // barbaz
If not... How would one go about getting this to work?