JavaScript Simplified / Chapter 55 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

Fill in the blank to loop through the array. spaceAliens______(displayFunnyName); .forEach \.forEach
Fill in the blank to loop through the array, calling the function displayIt on each iteration. spaceAliens____________; .forEach(displayIt) \.forEach\(displayIt\)
Loop through the array pets, calling the function feedThem on each iteration. pets.forEach(feedThem); pets\.forEach\(feedThem\);
Loop through the array x, calling the function y on each iteration. x.forEach(y); x\.forEach\(y\);
Fill in the blank to complete the anonymous function. spaceAliens.forEach(________{
  console.log(anAlien);
});
function(anAlien) function\(anAlien\)
Loop through an array. Use an anonymous function to display each element in the console. Make up everything. recipes.forEach(function(aRecipe) {
  console.log(aRecipe);
});
[a-z_$][a-zA-Z0-9_$]*\.forEach\(function\(([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]console\.log\(\1\);[\r\n]}\);
Fill in the blank to loop through the array to display each element in the console. Use a shorthand arrow function. The variable is anAlien. spaceAliens.forEach(__________________________; anAlien => console.log(anAlien)) anAlien=>console\.log\(anAlien\)\)
Loop through an array. Use a shorthand arrow function to display each element in the console. Make up everything. recipes.forEach(aRecipe => console.log(aRecipe)); [a-z_$][a-zA-Z0-9_$]*\.forEach\([a-z_$][a-zA-Z0-9_$]*=>console\.log\(\1\)\);
  1. I've coded an array. Leave my code intact.
  2. Loop through the array, using an anonymous function to display each element in an alert.
  3. Click the Result button (or, after revising, don't click, just wait).
  4. Wait a moment.
  5. If you've coded correctly, a series of alerts will display the elements.
  6. Dismiss each alert by clicking OK.
  7. For help with this code, see Chapter 55 in the book.
  1. I've coded an array. Leave my code intact.
  2. Loop through the array, using a shorthand arrow function to display each element in an alert.
  3. Click the Result button (or, after revising, don't click, just wait).
  4. Wait a moment.
  5. If you've coded correctly, a series of alerts will display the elements.
  6. Dismiss each alert by clicking OK.
  7. For help with this code, see Chapter 55 in the book.