

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Arrays
incomplete
2: Array Length
incomplete
3: Array Spread
incomplete
4: Includes
incomplete
5: For...of Loops
incomplete
6: Slicing Arrays
incomplete
7: const Arrays
incomplete
8: Destructure
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
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]
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.