General Assembly Logo

Control Flow Practice

The purpose of this exercise is to practice working with loops and conditionals. Think of it as doing reps or practicing scales! The more you practice, the better you'll get.

Prerequisites

  • Fundamental JavaScript: syntax, data types, and arrays
  • Conditions, including if, if/else, and if/else if/else
  • Loops, both for loops and while loops

Instructions

  1. Fork and clone this repository.
  2. Change into the new directory.
  3. Fulfill the listed requirements.

Starter code is available in lib/challenge.js.

Important: Make a commit after each prompt.

Requirements

There are a series of prompts inside lib/challenge.js. Work through all of the prompts. Each prompt is in the form of a JavaScript comment. Write your code to solve the prompt after the comment. Commit your code after you solve a prompt.

Some prompts will require you to practice researching methods we did not learn in class. This is intended to help you learn to become a more independent developer.

Optional:

If you're curious about whether your code passes the tests written for this assignment, you can do the following:

  1. From inside this directory, run npm install in your terminal. This will download the testing dependencies (mocha and chai).
  2. Run npm test in the directory. Read the output to checkout which tests your code is passing and failing.
  3. If there are any errors, try fixing them and running the code again.