I think I may be missing something coming to object reference, in the below case, is this refering to the test object? If not how can I declare b so in the end test.a = test.b ?
test = {
a: 1,
b: this.a,
check : function(){
console.log(test.a); // returns 1
console.log(test.b); // returns undefined
}
};
test.check();
Thanks a lot
You can declare it like this:
Live example: http://jsfiddle.net/Rqs86/