Media Computation Skills Lab

MTEC 1003

Lab 8 / Part 1 - JavaScript For Loops

In this lab, you’ll be creating several programs:

  1. tens
  2. party
  3. average
  4. largest
  5. fizzbuzz

Instructions

Setup

ProTip: Bookmark the following page so that you can easily repeat these steps in your future labs!

Cloning a Remote Repo Using Your GitHub API Access Token


tens

Write a program that counts by 10’s from 20 to 100

20
30
.
.
100

party

Write a program that acts for user input… and counts down from that number to exactly 1. After it counts down to 1, it says “PARTY TIME!!!”.

# Run 1: 
# -----
Let's party...
(prompt) How long 'til the party?
> 3
3
2
1
PARTY TIME!!!

# Run 2: 
# -----
Let's party...
(prompt) How long 'til the party?
> -1
PARTY NOW!!!

average

Ask for four numbers, output the average of those numbers. Use a for loop to do this.

(prompt) Number please...
> 4
(prompt) Number please...
> 6
(prompt) Number please...
> 1
(prompt) Number please...
> 9
The average is 5.

largest

Ask for four numbers, output the largest of those numbers. Use a for loop to do this.

(prompt) Number please...
> 4
(prompt) Number please...
> 6
(prompt) Number please...
> 1
(prompt) Number please...
> 9
The largest number is 9

fizzbuzz

Count from 1 to 100, but print out fizz or buzz depending on special conditions.

1
2
Fizz
4
Buzz
Fizz
.
.
14
FizzBuzz
16
.
.
98
Fizz
Buzz

MTEC 1003 - Media Computation Skills Lab