I'am trying to fill an array (rooms) with the same object type (room).
This works fine :
var rooms = new Array(10);
for (var i=0; i<10; i++){
rooms[i] = new room();
}
Isn't there any other method that takes only one line of code to do the same thing?
I've tried :
var rooms = new Array(10).fill(new room());
but each box of the array contains the same object (same reference).
Thanks.