I am trying to learn JavaScript and came to a dead end. Version ES5.
var person = {
cars: ["Ford", "Mercedes", "S Coupe"],
garages: { 1: this.cars },
};
console.log(person);
//outputs
// {
// cars: [ 'Ford', 'Mercedes', 'S Coupe' ],
// garages: { '1': undefined }
// }
Why is garages["1"] undefined? is it because cars is not initialized?