lOMoARcPSD|14409931
Course: INFO3144
Professor: Jim Cooper
Project: Lab #2
Due Date: Monday/Tuesday, October 1/2, 2018 11:30 pm
Submitting: Submit your zipped solution to the Lab 2 drop-box
How will my lab be marked?
Marks How are the Marks Awarded? Mark
Available Assigned
3 Web page runs and meets the requirements listed below
1 Reasonable level of comments
1 Web Page is zipped and submitted on-time to the drop box
5 Total
Lab Description
This lab will require you to add some new code to the Lab2.html web page. As we’ve often done in
the past, rename the Lab2.html file to “your first name_lab2.html” for example “Jim_lab2.html”
The purpose of the lab is to create a proof of concept for a simple logging system that can receive
calls from multiple asynchronous “timers.” We’ll use the JavaScript “setInterval” method to create
timers that can call a function at various times.
Requirements:
Based on the source code listing shown on the next page, notice that we’re starting with:
1. A single global array called “timers.”
2. An IIFE (Immediately Invoked Function Expression) called “log”
3. A function literal called “printFunc” which is a “wrapper” function used to output a string
(followed by a “<br>”) with “document.write.”
4. An “onload” event handler called “startMeUp” which we use to initialize 3 sample timers using
the “setInterval” method. Remember that “setInterval” requires 2 parameters (a function
reference to be called and an interval in milliseconds to define the frequency with which the
function will be called). Also remember that “setInterval” returns a unique integer number that
can be used to perform a “clearInterval” on a specific timer.
In order to complete the lab, you must add some code to the IIFE starting after line 14.
1. Return an anonymous function declaration (see Example #3 – newObject in functions.html).
Your anonymous function should define a single parameter named caller which represents
the particular timer (Timer1, Timer2 etc.).
2. Within the anonymous function declaration, you will have access to all the parameters and
local variables of the parent function. As such, on each invocation:
©2018 Fanshawe College Page 1 of 3 INFO3144, Fall 2018
Downloaded by Abdofa Kech ()
Course: INFO3144
Professor: Jim Cooper
Project: Lab #2
Due Date: Monday/Tuesday, October 1/2, 2018 11:30 pm
Submitting: Submit your zipped solution to the Lab 2 drop-box
How will my lab be marked?
Marks How are the Marks Awarded? Mark
Available Assigned
3 Web page runs and meets the requirements listed below
1 Reasonable level of comments
1 Web Page is zipped and submitted on-time to the drop box
5 Total
Lab Description
This lab will require you to add some new code to the Lab2.html web page. As we’ve often done in
the past, rename the Lab2.html file to “your first name_lab2.html” for example “Jim_lab2.html”
The purpose of the lab is to create a proof of concept for a simple logging system that can receive
calls from multiple asynchronous “timers.” We’ll use the JavaScript “setInterval” method to create
timers that can call a function at various times.
Requirements:
Based on the source code listing shown on the next page, notice that we’re starting with:
1. A single global array called “timers.”
2. An IIFE (Immediately Invoked Function Expression) called “log”
3. A function literal called “printFunc” which is a “wrapper” function used to output a string
(followed by a “<br>”) with “document.write.”
4. An “onload” event handler called “startMeUp” which we use to initialize 3 sample timers using
the “setInterval” method. Remember that “setInterval” requires 2 parameters (a function
reference to be called and an interval in milliseconds to define the frequency with which the
function will be called). Also remember that “setInterval” returns a unique integer number that
can be used to perform a “clearInterval” on a specific timer.
In order to complete the lab, you must add some code to the IIFE starting after line 14.
1. Return an anonymous function declaration (see Example #3 – newObject in functions.html).
Your anonymous function should define a single parameter named caller which represents
the particular timer (Timer1, Timer2 etc.).
2. Within the anonymous function declaration, you will have access to all the parameters and
local variables of the parent function. As such, on each invocation:
©2018 Fanshawe College Page 1 of 3 INFO3144, Fall 2018
Downloaded by Abdofa Kech ()