JavaScript Simplified / Chapter 87 Exercises

  • Index of exercises
  • Email me

1

2

3

4

5

6

7

8

9

10

Congratulations. You've aced all the exercises for this chapter.


To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.


Are you ready to rate JavaScript Simplified? on Amazon?


Rate it on Amazon.

0,1,2,3,4,5,6,7,8,9

0

0

0

0

The spread operator works with arrays and _____. objects objects
The spread operator copies the ______ of arrays. elements elements
Fill in the blank to include the elements of the array firstArray in the array secondArray. const secondArray = [1, 2, 3, _______]; ...firstArray \.\.\.firstArray
Fill in the blank to include the properties of the object smallTeam in the object largeTeam. const largeTeam = {
  players: 10,
  _________
};
...smallTeam \.\.\.smallTeam
Create a new array comprising one string and all the elements of another array. Make up everything. const pets = ["fish", ...domesticatedMammals]; const[a-z_$][a-zA-Z0-9_$]*=\[•.*•,\.\.\.[a-z_$][a-zA-Z0-9_$]*\];
In the console display the elements of an array using the spread operator. Make up the name of the array. console.log(...planets); console\.log\(\.\.\.[a-z_$][a-zA-Z0-9_$]*\);
Add the elements of an array to the end of another array. Make up the names of the arrays. array1.push(...array2); [a-z_$][a-zA-Z0-9_$]*\.push\(\.\.\.[a-z_$][a-zA-Z0-9_$]*\);
Combine the properties of two objects into a new third object. Make up everything. const allBusRoutes = {
  ...expressBusRoutes,
  ...localBusRoutes
};
const[a-z_$][a-zA-Z0-9_$]*={[\r\n]\.\.\.[a-z_$][a-zA-Z0-9_$]*,[\r\n]\.\.\.[a-z_$][a-zA-Z0-9_$]*[\r\n]};
  1. Create an array.
  2. Create a second array that comprises some integers plus the elements of the first array.
  3. Display the second array in an alert.
  4. Wait a moment.
  5. If you've coded correctly, an alert will display the second array.
  6. Dismiss the alert by clicking OK.
  7. For help with this code, see Chapter 87 in the book.
  1. Create two arrays.
  2. The second array contains the elements of the first array plus a new element.
  3. Create a third array that contains the elements of the second array.
  4. Display the elements of the third array in an alert.
  5. Wait a moment.
  6. If you've coded correctly, an alert will display the third array.
  7. Dismiss the alert by clicking OK.
  8. For help with this code, see Chapter 87 in the book.