Preview

JavaScript Arrays Lab

Satisfactory Essays
Open Document
Open Document
531 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
JavaScript Arrays Lab
BRITISH COLUMBIA INSTITUTE OF TECHNOLOGY
JavaScript lab exercise
COMP-1536
Due: At the end of the lab period
School of Computing and Academic Studies
Program: CST

The objective of this lab is to familiarize you with JavaScript, JavaScript arrays, and JavaScript debugging.
Startup
Start by downloading and extracting a file named ChineseZodiacForLoopStartup.zip. You will find the following files:
The Images folder contains 12 images that represent the Chinese Zodiac animals. Notice that some images are in GIF format and others are in PNG format.
Chinese_Zodiac_for_loop_1D.html has the code that declares and initializes two arrays. The first array SignNames contains the Chinese Zodiac signs. The second array SignImages contains the Chinese Zodiac animal images. Here’s a pictorial representation of both of these arrays:

SignNames 1D Array
Rat
Ox
Tiger
Rabbit
Dragon
Snake
Horse
Goat
Monkey
Rooster
Dog
Pig

SignImages 1D Array rat.gif ox.gif tgr.gif rbt.png drgn.png snk.png hrs.gif gt.gif mnky.png rstr.gif dog.gif pig.gif

Chinese_Zodiac_for_loop_2D.html has the code that declares and initializes a single array named signs. The signs array is essentially a two dimensional array that holds both the 12 sign animal names and their respective animal image files. Here’s a pictorial representation of the signs 2D array:

signs 2D Array
Rat
Ox
Tiger
Rabbit
Dragon
Snake
Horse
Goat
Monkey
Rooster
Dog
Pig rat.gif ox.gif tgr.gif rbt.png drgn.png snk.png hrs.gif gt.gif mnky.png rstr.gif dog.gif pig.gif
Your Mission
Write dynamic JavaScript for-loop(s) that display a table with the 12 Chinese Zodiac signs as column header, and the years displayed below the appropriate column headings. Begin the table with the year 1912 and end with the current year. Get the current year from the JavaScript Date() object. You may want to use the modulus operator to determine the number of columns in each row of the table.
Use the arrays in each HTML file that contains the appropriate sign and

You May Also Find These Documents Helpful

  • Powerful Essays

    The purpose of this Lab. is to familiarize student how to solve practical problems programmatically; they will practice on elementary programming using primitive data types, variables, constants, operators, expressions, and input and output. Also, they will learn how to diagnose errors that may occur when a program is compiled or executed. There are some exercises, through which they will understand the concept learn in this chapter.…

    • 2338 Words
    • 10 Pages
    Powerful Essays
  • Satisfactory Essays

    Devs010 Unit 3 Assignment

    • 261 Words
    • 2 Pages

    Lab practical will be used to carry out these tasks, students will be prompted to develop programs in JavaScript.…

    • 261 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    two meaning. for example one of the symbols is a picture of Martha. The picture of Martha…

    • 973 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Drivers Ed

    • 351 Words
    • 2 Pages

    3. Learning about what signs mean based on the image and text on the sign.…

    • 351 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Chapter 1 study guide

    • 672 Words
    • 3 Pages

    A list of the characters that can be used in a given language or languages, mapped to corresponding unique binary codes and published as a convention or standard so that computers can use a consistent set of binary values to represent text values. (ex ASCII, ANSI, and Unicode)…

    • 672 Words
    • 3 Pages
    Good Essays
  • Good Essays

    The Rabbits

    • 472 Words
    • 2 Pages

    This picture book shows a lot of symbols which enhances more of an illustration for example the rabbits themselves are a symbol as they represent the British who colonised and also the billibies represent the aborigines.…

    • 472 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Zodiac Signs

    • 553 Words
    • 3 Pages

    The word Zodiac comes from the Greek word Zodion, which means “Little animal.” The zodiac signs are the constellations along the Ecliptic at the respective points at certain days of the year. The zodiac signs are: Leo the Lion, Gemini the Twins, Aries the Ram, Sagittarius the Centaur, Taurus the Bull, Virgo the Virgin, Cancer the Crab, Libra the Scales, Capricorn the Seagoat, Scorpio the Scorpion, Aquarius the Water Bearer, and Pisces the Fish. One can find their zodiac sign by using a Celestial Sphere, a model of space by representing constellations and other astronomical figures on an imaginary bubble surrounding the earth. On the path in which the sun moves, known as the ecliptic, there are the individual days of the year. If a person finds where the sun meets their…

    • 553 Words
    • 3 Pages
    Good Essays
  • Good Essays

    The Suit Film Analysis

    • 513 Words
    • 3 Pages

    My icons are as followed: a gavel, a justice scale, a brain, a collar and tie, a marijuana leaf and a pair of handcuffs. The gavel was created with a series of heavy weighted lines and geometric shapes. The justice scale was created with more irregular shapes; the arms, chains and bowls. The brain is very intricate, both in reality and…

    • 513 Words
    • 3 Pages
    Good Essays
  • Powerful Essays

    Semiotic & Feminist Analysis

    • 2542 Words
    • 11 Pages

    L103, L. (2000, Sept 4). ICON, INDEX and SYMBOL (Short Version). Retrieved Feb 14, 2012, from www.cs.indiana.edu: http://www.cs.indiana.edu/~port/teach/103/sign.symbol.short.html…

    • 2542 Words
    • 11 Pages
    Powerful Essays
  • Better Essays

    guide to tut

    • 832 Words
    • 6 Pages

    there? How does one refer to the initial array element? To the final array element?…

    • 832 Words
    • 6 Pages
    Better Essays
  • Good Essays

    Analysis of Two Way Table

    • 6239 Words
    • 25 Pages

    yij i= 1,2 ,…,I j= 1,2,…,J and displayed in a rectangular array as shown below…

    • 6239 Words
    • 25 Pages
    Good Essays
  • Good Essays

    The second array element directly follows the first in memory; and so on. However, it is not important that the indices start at zero; they may start with any number as long as they may start with any number as long as they are contiguous.…

    • 1020 Words
    • 5 Pages
    Good Essays
  • Powerful Essays

    Chapter one was a window that gave us a peek into the entire course. Our goal was to understand the basic structure of functions and function notation, the toolkit functions, domain and range, how to recognize and understand composition and transformations of functions and how to understand and utilize inverse functions. With these basic components in hand we will further research the specific details and intricacies of each type of function in our toolkit and use them to model the world around us.…

    • 12907 Words
    • 52 Pages
    Powerful Essays
  • Good Essays

    Chinese Martial Arts

    • 1271 Words
    • 6 Pages

    | This article contains Chinesetext. Without proper rendering support, you may see question marks, boxes, or other symbolsinstead of Chinese characters.…

    • 1271 Words
    • 6 Pages
    Good Essays
  • Powerful Essays

    Binary Information

    • 2445 Words
    • 10 Pages

    Unicode identifies each character using, 0s and 1s. It’s a larger code, consisting of 1 to 4 bytes…

    • 2445 Words
    • 10 Pages
    Powerful Essays