I have the following code
var Datos = function(){
this.salas = ['something','other'];
}
Datos.prototype.getSalas = function(){
return this.salas;
}
Then, If I do
var datos = new Datos();
var myArray = datos.getSalas();
Why "myArray" var is now a function and not an array?
How can I convert to an array this variable?
Works for me:
var Datos = function(){
this.salas = ['something','other'];
}
Datos.prototype.getSalas = function(){
return this.salas;
}
var datos = new Datos();
var myArray = datos.getSalas();
console.log(myArray);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.