I am trying to create a JSON object to store some parameters for a program. Some of the parameters need to be calculated from others as they are being defined. I would like to do this within the object definition but maybe this is not possible
var params = {
a: 50,
b: 70,
c: this.a+this.b
}
Result
What happens
>params.c
NaN
What I wished happened
>params.c
120
Edit
After doing some further reading, I think I am using Object Literal Notation instead of JSON.