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

What is the keyword for getting text in a paragraph? textContent textContent
Fill in the blank to assign the text in the paragraph to the variable. let txt = targeted paragraph__________________ .textContent; \.textContent;
A targeted paragraph has been assigned to a variable, pgraph. Insert the string "Hi" into it. pgraph.textContent = "Hi"; pgraph\.textContent=•Hi•;
The targeted paragraph has been assigned to a variable. Assign the text in the paragraph to a variable that hasn't been declared beforehand. Make up the variable names. let txt = pgraph.textContent; let[a-z_$][a-zA-Z0-9_$]*=[a-z_$][a-zA-Z0-9_$]*\.textContent;
Insert a string into a span that has been assigned to the variable s1. Make up the string. s1.textContent="California"; s1\.textContent=•.*•;
If the text in p1 is "star", display an "ok" alert. if (p1.textContent === "star") {
  alert("ok");
}
if\(p1\.textContent===•star•\){[\r\n]alert\(•ok•\);[\r\n]}
What is the textContent of the following paragraph? <yes<br>no> yesno yesno
The page includes a single h1 heading. Insert a string into it using the querySelector key word. Make up the string. document.querySelector("h1").textContent = "Big News"; document\.querySelector\(•h1•\)\.textContent=•.*•;
  1. Click the HTML button to see my markup.
  2. Click the JS button.
  3. In a single statement, display the paragraph text in an alert.
  4. Click the Result button (or, after revising, don't click, just wait).
  5. If you've coded correctly, the paragraph text will display in an alert.
  6. Dismiss the alert by clicking OK.
  7. For help with this code, see Chapter 69 in the book.
  1. Click the HTML button to see my markup.
  2. Click the JS button.
  3. In a single statement, copy the text in the first paragraph (#p1) to the second paragraph (#p2).
  4. Click the Result button (or, after revising, don't click, just wait).
  5. If you've coded correctly, the paragraph text will display a second time in the Result panel.
  6. For help with this code, see Chapter 69 in the book.