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

    Array Structure Paper

    • 833 Words
    • 4 Pages

    Once again Berry’s Bug Blasters are requesting an update to the previous program that was designed to help them to better serve their customers. The company has requested a way to display the name and phone number of their clients so that they can keep a record of what clients have called. The best way in the opinion to accomplish this is to build an array into the program. This will allow those in charge of the company record to record who has called and then to display the names of the clients and their number in a chart so that it can be recalled at a later date as needed.…

    • 833 Words
    • 4 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
  • 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
  • Powerful Essays

    The modern era of this day and age is under constant threat from new and expanding methods of conflict that is devastating our already deteriorating society- often segregated between the rich and the poor. Due to the steady increase of communication and travel, there is a correlation with the increase amount of fighting with age old ethnic rivalries and religious strife along with disputes over territory, resources and morals. However, with the considerable advancements in technology presented over the last century, the effects and devastation are more vast and noteworthy. Prior instances being the innovation of the Maxim Machine gun in the nineteenth century that took the lives of millions of people in World War I, the bringer of the war of…

    • 1599 Words
    • 7 Pages
    Powerful Essays
  • Good Essays

    Wayson Choy

    • 681 Words
    • 3 Pages

    Choy’s writing is adept, subtle, wry, and humane. In it he explores racism, politics and violence, all with the deep understanding. He also explores the themes of maturing, belonging, death, revealing the real self, etc. One of the themes which he also explores in the book is the signs. He believes in signs. . “He patiently unfolds the secrets of his past and searches for meaning in coincidence.”…

    • 681 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

    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
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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