We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Array Spread

Remember the spread syntax for merging object properties? It works with arrays too! It expands the elements of an array into individual elements and inserts them into another array.

const nums = [1, 2, 3];
const newNums = [...nums, 4, 5, 6];
console.log(newNums);
// Prints: [1, 2, 3, 4, 5, 6]

Assignment

Complete the uploadNewMessages function. It accepts the oldMessages array, which is the database of messages already in the Textio system, and a newMessages array, which are the new messages we need to add to the system.

It should return a new array containing all the messages from both arrays, with the old messages first, followed by the new messages.