I have such a simple code
var q = {
p1: 'kv3',
p2: 'http://google.com/' + this.p1
};
console.log(q.p2);
which I expect to output the p2 + p1, but for some reason the p1 seems to be undefined when I console.log. Isn't p1 initialized before p2?
What would be the correct code for this?
thisis only set when you call a function.