JavaScript Editor Javascript source editor     Web programming 



Team LiB
Previous Section Next Section

Workshop

The workshop is designed to help you anticipate possible questions, review what you've learned, and begin learning how to put your knowledge into practice.

Quiz

1.

What construct can you use to define an array?

2.

What function would you use to join two arrays?

3.

How would you declare a class called emptyClass that has no methods or properties?

4.

How would you choose a name for a constructor method?

Answers

1.

array()

2.

array_merge()

3.

Use the class keyword:

class emptyClass {
}

4.

You don'ta constructor is named for the class in which it resides.

Activities

  1. Create a multidimensional array of movies organized by genre. This should take the form of an associative array with genres as keys, such as Science Fiction, Action, Adventure, and so forth. Each of the array's elements should be an array containing movie names, such as Alien, Terminator 3, Star Wars, and so on. When your arrays are created, loop through them, printing the name of each genre and its associated movie(s).

  2. Create a class called baseCalc() that stores two numbers as properties. Next, create a calculate() method that prints the numbers to the browser. Finally, create classes called addCalc(), subCalc(), mulCalc(), and divCalc() that inherit functionality from baseCalc() but override the calculate() method and print appropriate totals to the browser.

    Team LiB
    Previous Section Next Section


    JavaScript Editor Javascript source editor     Web programming

    
    Outplacement services Houston . Carpet cleaning Vancouver WA