I'm trying to access a value from the current value's parent but without success. I have these 2 sample javascript codes to demonstrate my issue:
1)
var x = {
y : {
a : "a",
ab : this.a + "b"
}
};
console.log(x.y);
> Object {
a : a,
ab : undefinedb
}
2)
var x = {
y : {
a : "a",
ab : x.y.a + "b"
}
};
console.log(x.y); // Uncaught TypeError: Cannot read property 'y' of undefined