Jeffrey-Fazal / js-loops-01

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JavaScript Loops Part 1

Getting Started

  1. Fork this repo and git clone it down to your computer
  2. Create two files index.html and script.js
  3. Include script.js in index.html using a <script> tag
  4. Open index.html in your web browser and open the console
  5. After answering each section below, git commit your work
  6. When you're finished or when time is up, push your work to your remote repo, file a Pull Request, and react with a green check on Zoom

Every 2

Using a for loop, print every second number e.g. 0, 2, 4, 6, 8.

9 to 3

Using a for loop, print backwards from 9 to 3 e.g. 9, 8, 7, 6, 5, 4, 3.

9 Times Table

Write a program that prints exactly the following using a for loop:

9 Times Table
================
9 times 0 is 0
9 times 1 is 9
9 times 2 is 18
9 times 3 is 27
9 times 4 is 36
9 times 5 is 45
9 times 6 is 54
9 times 7 is 63
9 times 8 is 72
9 times 9 is 81
9 times 10 is 90
================

Even/Odd Reporter

Use a for loop that will iterate from 1 to 20. For each iteration, check if the current number is even or odd, and log it in the console (e.g. "2 is even").

1 is odd
2 is even
3 is odd
4 is even
5 is odd
// etc

About


Languages

Language:JavaScript 64.2%Language:HTML 35.8%