GRAPHIC JAVASCRIPT

Back to index

As you have seen in previous lessons, there are several ways of modifying the appearance of letters in JavaScript. You can easily alter the size, font face, color, and style.

In this lesson we will take a look at arrays. In fact, we will make arrays with the following names: person, noun, verb, adj, and prep. Here's what one of them looks like:

prep = [ "in", "on", "into", "by", "down" ]; This array contains five items. The items in the list can be referenced like this: prep[0] prep[3] The value of prep[0] is "in" and the value of prep[3] is "by" since the first item in an array is always item zero.


EXAMPLE:
This applet is an approximation of what the student will be expected to create. Inspect the source code and be sure that you understand how it works to produce the what's displayed on this page.
ASSIGNMENT:
The student will create an applet which displays seven sentences. Each sentence should contain two nouns, an adjective, an adverb, and a verb. The nouns should be displayed in bold, the verbs should be displayed in italics, and the words in each group should be displayed using a different color. It might be necessary to alter the size of the canvas area. Each sentence should contain a minimum of eight words. All word groups should be stored in arrays.
Your browser does not support the HTML5 canvas tag.