When and why would we type object literals? Isn't it a bit primitive if the key value pairs can't interact? What am I missing, what's the educated way to go in the examples below?
Here gravity will result in NaN
var ball = {
size:10,
gravity:this.size/2
}
Here gravity will result in a successful 5
var ball = {
size:10
}
ball.gravity = ball.size/2;
Here gravity will result in a successful 5
var ball = {};
ball.size = 10;
ball.gravity = ball.size/2;