My attempt to use .concat()
in order to combine two objects is resulting in
tiles.concat is not a function
The following code (in an angular app and written in 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'm puzzled about why it's not working correctly, especially since it seems similar to this example
UPDATE
Similar to the provided example, my JSON data consists of an array of objects with matching structures.