101 Exercises

Instructions

Quick Start

  1. Create yourself an account on Glitch.com
  2. Click on the fish icon in the upper right and select "Remix on Glitch" to make your own copy
  3. Use Glitch.com as your editor
  4. Launch index.html with the "Preview" icon in the Glitch editor. The "Preview" icon is at the bottom of the screen. Recommend using "Preview in a New Window"
  5. The keyboard shortcut to launch the application is Ctrl + Shift + R (same as previewing in a new window)

Expected Workflow

  • From this page, open the JavaScript console to see the next error.
  • Each error message tells you the next exercise to solve or bug to fix.
  • Use the glitch.com editor to make changes in your 101-exercises.js file
  • Refresh the index.html page
  • Repeat

What to do when you don't know what to do next

When the exercise asks you to reverse an array in JavaScript, the way forward is to search for "How to reverse an array in JavaScript" in your favorite search engine.

When the exercise asks you to check if a number is even, the way forward is to search for "how to check if a number is even in JavaScript".

When the exercise has you calculate the area of a circle, the way forward is to search for "how to calculate the area of a circle in JavaScript" or "How to get pi in JavaScript".

The pattern for finding what you need in JavaScript is to rely very heavily on search engine searches so you can find examples of working code and discussions about code that speak to your questions.

Orientation

  • This index.html page shares the instructions and the JS console shows errors.
  • The only time your JS Console will show no errors is when all the exercises have working solutions.
  • Open the JavaScript console in Firefox or Chrome
    • For Mac, the keyboard shortcut is "Command + Option + i"
    • For Windows, the keyboard shortcut "Shift + CTRL + j".
  • Start writing solutions inside of 101-exercises.js in the editor.
  • Refresh this index.html to re-run you new JS code, then check your JS Console to see that your solution worked or if there's something

Rationale

101 Exercises exists to help learners gain deep practice with fundamentals, operators, syntax, and converting problems in English to solutions in JS.

The best way to learn how to program is write programs. Each exercise is a tiny little program.

Expect to do a tremendous amount of search engine searches, make many mistakes, and try again. This is all part of programming. Take breaks.


Troubleshooting

General Guidance

  • Your JS code runs from top to bottom
  • Solve the exercises one at a time and in order.
  • Fix any syntax errors before moving forward with the exercises
  • Any synax error in your code may halt the execution of all of your code.
  • Double check your spelling. Capitalization matters in programming.
  • Solve one thing at a time and avoid jumping around.
  • Each exercise must pass its tests in order for you to see the next exercise.
  • If you have an incorrect answer or syntax error on an exercise, fix it before moving forward.

Error messages

Reference Error means you need to define the variable or function.
The number by the 101-exercises.js filename highlights the line where the variable is referenced before it exist

image of a reference

Syntax Error means there's a syntax error that needs to be fixed.
The number by the 101-exercises.js filename highlights the line where the syntax error exists.

image of a syntax error

Uncaught Error means the answer is incorrect and doesn't match the test.
The largest number by the 101-exercises.js filename specifies the line of code for the exercise where there is a mismatch.
In this example, line 36 of 101-exercises.js specifies where there is an error. The earlier line numbers reference the assertion testing function itself.

uncaught error message

Video Demonstration of Workflow


If you notice any typos, misspellings, or mistakes, please triple check your work and open an issue on GitHub citing both the line number and exercise number.


Problems Correct