Greetings.
I've been trying to know how to get the properties of an object that is at the same time inside another object. This comes as a result of a programming book.
The code is as follows.
1st we have the object:
function Concesionario(cod_oficina_in,ciudad_in,responsabilidad_in){
this.cod_oficina = cod_oficina_in;
this.ciudad = ciudad_in;
this.responsabilidad = responsabilidad_in;
}
function Coche(marca_in,modelo_in,anyo_in,concesionario_in){
this.marca = marca_in;
this.modelo = modelo_in;
this.anyo = anyo_in;
this.concesionario = concesionario_in;
}
var concesionario_atocha = new Concesionario('281','Madrid','Pedro Bravo');
var mi_coche = new Coche('Citroen','C4','2010',concesionario_atocha);
By means of a for..in I can extract the properties of an object in this case my_car
My question is:
How can I show or store the properties of the concession-holder object to which it belongs as property of the my_car object? a for..in, for, while loop or through a function ..?
for( indice in mi_coche){
document.write(....propiedades.concesionario_atocha ... ? )
}
Thank you for your attention. It's already a question that I want to get out of my head since I've tried everything, nested for..in loop, nested for, while, use of arrays .. no idea.