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

Using the new Set() constructor, you create a set by converting an _____ to a set. array array
An array has been assigned to the variable cities. Convert it to a set. Make up the name of the set. const setOfCities = new Set(cities); const[a-z_$][a-zA-Z0-9_$]*=newSet\(cities\);
Here's an array: [1, 1, 2, 3, 4]. When converted to a set, the values will be {_______} 1, 2, 3, 4 1,2,3,4
Fill in the blank to convert the array to a set. const arrayOfMammals = ________(setOfMammals); Array.from Array\.from
An array's elements are 1, 2, 3. Convert the array to a set. Make up the set name. const numsSet = new Set([1, 2, 3]); const[a-z_$][a-zA-Z0-9_$]*=newSet\(\[1,2,3\]\);
Convert a set named plots to an array. Make up the name of the array. const arrayOfPlots = Array.from(plots); const[a-z_$][a-zA-Z0-9_$]*=Array\.from\(plots\);
Convert a set to an array. Make up the names. const x = Array.from(y); const[a-z_$][a-zA-Z0-9_$]*=Array\.from\([a-z_$][a-zA-Z0-9_$]*\);
The elements of an array named mammals are "loris", "tiger", "cat", "cat". Convert the array to a set whose elements are "loris", "tiger", "cat". Make up the name of the set. const mammalSet = new Set(mammals); const[a-z_$][a-zA-Z0-9_$]*=newSet\(mammals\);
  1. I've coded an array. Convert it to a set.
  2. Convert the set back to an array whose name is newArray.
  3. Display an element of newArray in an alert.
  4. Click the Result button (or, after revising, don't click, just wait).
  5. If you've coded correctly, an alert will display the element.
  6. Dismiss the alert by clicking OK.
  7. For help with this code, see Chapter 99 in the book.
  1. Click the HTML button to see the empty paragraph, whose ID is "p1", that I've coded
  2. Click the JS button.
  3. Code a set.
  4. Convert the set to an array.
  5. Display one of the elements of the array in the paragraph whose ID is "p1".
  6. Wait a moment.
  7. If you've coded correctly, the element will show up in the Result panel.
  8. Dismiss the alert by clicking OK.
  9. For help with this code, see Chapter 99 in the book.