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

Code the alternative to the following code. const num = 12;
export { num };
export const num; exportconstnum;
Code the alternative to the following code. export const num = 12; const num = 12;
export { num };
constnum=12;[\r\n]export{num};
Fill in the blank so the importing script can import all the pieces of data without naming them. export _______ { num, showNum, anAnimal }; default default
Code the last line of a module that allows the importing script to import the variable population without naming it. export default { population }; exportdefault{population};
Code the last line of module that allows the importing script to import a function without naming it. Make up the name of the function. export default { doSomething }; exportdefault{[a-z_$][a-zA-Z0-9_$]*};
The module at "./mod1.js" has exported data using the default keyword. Code the import statement using someData as the variable name. import someData from "./mod1.js"; importsomeDatafrom•\.\/mod1\.js•;
The module at "./mod1.js" has exported data using the default keyword. The importing script has assigned the imported data to the variable importedStuff. An imported function is named doSomething. Call the function. importedStuff.doSomething(); importedStuff\.doSomething\(\);
The module at "./mod1.js" has exported a function using the default keyword. Code the import statement. Make up the variable name and the function name. Call the function. import importedStuff from "./mod1.js";
importedStuff.doSomething();
import([a-z_$][a-zA-Z0-9_$]*)from•\.\/mod1\.js•;[\r\n]\1\.[a-z_$][a-zA-Z0-9_$]*\(\);
  1. You're working in the HTML panel.
  2. The module at https://codepen.io/asmarterwaytolearn/pen/KKxavrq.js has exported a variable, name, using the default keyword.
  3. Import name.
  4. Display its value in an alert.
  5. Click the Result button (or, after revising, don't click, just wait).
  6. If you've coded correctly, an alert will display the name Tai.
  7. Dismiss the alert by clicking OK.
  8. For help with this code, see Chapter 96 in the book.
  1. You're working in the HTML panel.
  2. The module at https://codepen.io/asmarterwaytolearn/pen/KKxavrq.js has exported a function, sayHi, using the default keyword.
  3. Import the function.
  4. Call the function.
  5. Click the Result button (or, after revising, don't click, just wait).
  6. If you've coded correctly, an alert will dispolay Hi.
  7. Dismiss the alert by clicking OK.
  8. For help with this code, see Chapter 96 in the book.