Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

308 CHAPTER 6 Essential JavaScript and jQuery


Answers


This section contains the answers to the lesson review questions in this chapter.

Lesson 1



  1. Correct answer: C
    A. Incorrect: A property is a variable that’s defined on an object.
    B. Incorrect: A method is a function that’s defined on an object.
    C. Correct: A class is a blueprint for an object.
    D. Incorrect: An event takes place from external input, usually from user input.

  2. Correct answer: A
    A. Correct: The prototype is the starting object that is cloned when creating a new
    object.
    B. Incorrect: A property is a variable that’s defined on an object.
    C. Incorrect: A class is a blueprint for an object.
    D. Incorrect: An event takes place from external input, usually from user input.

  3. Correct answer: A
    A. Correct: You replace the prototype of the child object with a new instance of
    the parent object and then replace the prototype constructor with the child
    constructor.
    B. Incorrect: The createChild method is not a valid method.
    C. Incorrect: The setParent method is not a valid method.
    D. Incorrect: JavaScript does support inheritance by replacing the prototype of the
    child object with a new instance of the parent object and then replacing the proto-
    type constructor with the child constructor.


Lesson 2



  1. Correct answer: B
    A. Incorrect: The use of the hash (#) symbol in the CSS selector indicates that you
    want to locate an element based on its id.
    B. Correct: The use of the period (.) in the CSS selector indicates that you want to
    locate the elements that match the CSS class name.
    C. Incorrect: Supplying a name for a CSS selector indicates that you want to locate
    the elements that have that tag name.
    D. Incorrect: The var hidden = $(‘class=Hidden’); syntax is invalid.

Free download pdf