I'm trying to use .concat() to concatenate two objects, but it returns
tiles.concat is not a function
This is the code (angular app and coffeescript):
$scope.tiles = new UI();
$scope.tiles.loadUITiles();
console.log($scope.tiles);
$scope.rooms = new RoomData;
$scope.rooms.load();
buildSavedRoomsScope = (tiles,rooms) ->
console.log "tiles: " + tiles + " ||| Rooms:" + rooms
savedRooms = tiles.concat(rooms)
i = 0
while i < savedRooms.length
room = savedRooms[i]
room.saved = !room.hasOwnProperty('saved')
room.uid = (if room.saved then 'saved-' else 'notSaved-') + room.id
i++
room
$scope.savedRooms = buildSavedRoomsScope($scope.tiles, $scope.rooms)
console.log $scope.savedRooms
I don't understand what I'm doing wrong, as it look to me just like this
EDIT
Just like in the example, my JSON data is an array of object (same structure as the example above)
tilesat that particular moment...?console.log tilesto see exactly what it is.[object Object], which doesn't tell anyone anything.