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:
Downloaded by Abdofa Kech (faouzi.timliline33@gmail.com)
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller faouziabdelmajid. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.99. You're not tied to anything after your purchase.