var Carro = function(){
var marca;
var modelo;
//this.setMarca = setMarca;
this.setMarca = function(_marca){
this.marca = _marca;
}
this.setModelo = function(_modelo){
this.modelo = _modelo;
}
this.getMarca = function() {
return this.marca;
}
this.getModelo = function(){
return this.modelo;
}
}
var carro = new Carro();
var marca = [];
var modelo = [];
var i;
var string = " ";
carro.setMarca("Volkswagen");
carro.setModelo("Camaro");
alert(carro.getMarca() + " " + carro.getModelo());
for(i=0;i<5;i++){
marca[i] = carro.getMarca() + " " + i;
modelo[i] = carro.getModelo() + " " + i;
string = string.concat(marca[i] + "\n");
string = string.concat(modelo[i] + "\n");
}
alert(string);
I have a car class, it has getters and setters for the tag and the template.
How can I save the data in a single vector? I have separated into two vectors like this:
var marca = [];
var modelo = [];
Is there another way to merge both data into a single vector? for example:
var car = [];
car|0|->marca = carro.getMarca();
car|0|->modelo = carro.getModelo();