I'm looking to create javascript json object that has a dynamic field that will just return a value based on previously specified properties. So far This is what I have...
var car = {
color: 'red',
wheels: 4,
hubcaps: 'spinning',
age: 4,
full_name: this.color + ' ' + this.spinning
}
I was wondering if this is possible to do? My goal is to be able to reference values such as car.color or car.full_name. For this example car.full_name would return the value red spinning
full_name: function () { return this.color + ' ' + this.spinning; };. And use it likecar.full_name()