Section 2.4 Arrays, Objects, and Document Object Model (DOM) in JavaScript
Learning Objectives
After you have completed this section, you should be able to
- create and use JavaScript arrays for your client-side scripts.
- explain how object-oriented programming can be done in JavaScript.
- outline the object hierarchy of web documents.
- use the Math object, Data object, Boolean object, and Number object provided in JavaScript.
Activities
- Carefully read the learning objectives.
- Watch presentation part one for the section, part two, and part three;
- Read Chapter 10, JavaScript: Arrays; Chapter 11, JavaScript: Objects; and Chapter 12, Document Object Model (DOM): Objects and Collections.
- Find answers to the study questions below.
- Do exercises 10.8, 10.10, 10.14, 10.15, 10.16, and 10.17 in Chapter 10. Do exercises 11.2, 11.8, 11.9, 11.10, 11.14, 11.21, 11.22, 11.23, and 11.24 in Chapter 11. Do exercises 12.4 through 12.9 in Chapter 12.
Study Questions
- How are arrays created and used in JavaScript?
- How do you initialize an array?
- How do you pass arrays to functions in JavaScript?
- What are some built-in objects in JavaScript?
- What methods and data members does the Math object have?
- What methods do Array objects have?
- What objects does a web browser provide to JavaScript and other scripting languages?
- What methods and data members does the window object have?
- What methods and data members does the document object have?
- What methods does the String object have?
- What is a string in JavaScript?
- How do you initialize a string object in JavaScript?
- What methods does a Date object have?
- What are Boolean and number objects?
- What methods does a Boolean object have?
- What methods does a Number object have?
- What methods do String objects provide to search for a character or sequence in a string? How do you use these methods?
- How do you split strings?
- How do you obtain substrings?
- What markup methods do String objects provide? How do you use these markup methods?
- How do you create Boolean objects in JavaScript?
- How do you create number objects in JavaScript?
- What data members and methods do number objects have?
- What are objects in Document Object Model (DOM)?
- How do you reference objects in HTML5?
- How do you associate JavaScript functions with HTML5 events?
- What is the notion of collections in DOM?
- What is the all special collection in DOM? What elements/objects does it include?
- What is the children collection in DOM?
Review
Do the self-review exercises for Chapter 10, 11, and 12.
Summary
Read the Chapter 10, 11, and 12 summaries.