JavaScript Simplified / Chapter 91 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 add the language2 property to the child class. class AfricanNation extends Nation {
  constructor(name, language, language2) {
    super(name, language);
    this.language2 = ___________
  }
}
language2; language2;
Fill in the blank to add the language2 property to the child class. class AfricanNation extends Nation {
  constructor(name, language, ___________) {
    super(name, language);
    this.language2 = language2;
  }
}
language2 language2
Fill in the blank to add the language2 property to the child class. class AfricanNation extends Nation {
  constructor(name, language, language2) {
    super(name, language);
    ______________________
  }
}
this.language2 = language2; this\.language2=language2;
Fill in the blanks to include two properties from the parent class and add the language2 property to the child class. class AfricanNation extends Nation {
  constructor(name, language, language2) {
    ____________________
    ______________________
  }
}
super(name, language);
this.language2 = language2;
super\(name,language\);[\r\n]this\.language2=language2;
Fill in the blanks to include the name and language properties from the parent class and add the language2 property to the child class. class AfricanNation extends Nation {
  ___________________________
    ____________________
    ______________________
  }
}
  constructor(name, language, language2) {
    super(name, language);
    this.language2 = language2;
constructor\(name,language,language2\){[\r\n]super\(name,language\);[\r\n]this\.language2=language2;
Copy a single property from a parent class to a child class and add one property that's unique to the child class. Make up everything. class AfricanNation extends Nation {
  constructor(name, language) {
    super(name);
    this.language = language;
  }
}
class[A-Z][a-zA-Z0-9_$]*extends[A-Z][a-zA-Z0-9_$]*{[\r\n]constructor\(([a-z_$][a-zA-Z0-9_$]*),([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]super\(\1\);[\r\n]this\.\2=\2;[\r\n]}[\r\n]}
Copy a single property from a parent class to a child class and add one method that's unique to the child class. The method does nothing. Make up everything. class AfricanNation extends Nation {
  constructor(name) {
    super(name);
  }
  doNothing() {
  }
}
class[A-Z][a-zA-Z0-9_$]*extends[A-Z][a-zA-Z0-9_$]*{[\r\n]constructor\(([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]super\(\1\);[\r\n]}[\r\n][a-z_$][a-zA-Z0-9_$]*\(\){[\r\n]}[\r\n]}
Copy a single property from a parent class to a child class and add one method that's unique to the child class. The method displays the value of the property in the console. Make up everything. class AfricanNation extends Nation {
  constructor(name) {
    super(name);
  }
  showValue() {
    console.log(this.name);
  }
}
class[A-Z][a-zA-Z0-9_$]*extends[A-Z][a-zA-Z0-9_$]*{[\r\n]constructor\(([a-z_$][a-zA-Z0-9_$]*)\){[\r\n]super\(\1\);[\r\n]}[\r\n][a-z_$][a-zA-Z0-9_$]*\(\){[\r\n]console\.log\(this\.\1\);[\r\n]}[\r\n]}
  1. I've coded a class. Build on this class to create a new class.
  2. Add a property to the new class.
  3. Use the child class to create a new object.
  4. Display the value of the added property in an alert.
  5. Wait a moment.
  6. If you've coded correctly, an alert will display the property value.
  7. Dismiss the alert by clicking OK.
  8. For help with this code, see Chapter in the book.
  1. I've coded a class. Build on this class to create a new class.
  2. Add a method to the new class. The method displays the property value in an alert.
  3. Use the child class to create a new object.
  4. Call the method.
  5. Wait a moment.
  6. If you've coded correctly, an alert will display the property value.
  7. Dismiss the alert by clicking OK.
  8. For help with this code, see Chapter in the book.