E07: Project Euler Problem 1

The goal of this experience is to get you started learning to write very simple Javascript code using JSFiddle, and to get you acquainted with the “Workout of the Day” (WOD) pedagogical technique used in this course.

Prelude

If you haven’t already, download and install the Chrome Browser.

Next, create an account on JSFiddle and login. Then bring up the Javascript console with View > Developer > Javascript Console.

The WOD

For this practice WOD, solve Problem 1 from Project Euler. Note that you do not have to register with the site and submit your answer (though if you want to, you can).

Ready? Let’s begin:

  1. Start your timer.

  2. Create a Javascript function called “projectEulerOne”. The function should compute the answer and print it out to the console.

  3. Informally test your program by running it and inspecting the output.

  4. Press the “save” button to create a URL to refer to your code.

  5. Stop your timer and record your time. Be sure to record it, because you will need your WOD time data when you write your technical essay.

Rx: < 4 min Av: 4-6 min Sd: 6-8 min DNF: 8+ min

Demonstration

Once you’ve finished trying the WOD for the first time, watch me do it:

Standard WOD Caveats

You’ll learn significantly less from watching me solve the WOD if you haven’t attempted the WOD yourself first.

While it’s an achievement to finish the WOD no matter how long it takes, you might experience “diminishing returns” if you work longer than the DNF time. Thus, it is usually strategic to stop working at the DNF time and watch my solution.

After watching my solution, I recommend that you repeat the WOD if you have not achieved at least Av performance. If so, be sure to:

Feel free to keep trying until you make Rx if that’s of interest to you.

Submission Instructions

To be completed by the time and date indicated on the Schedule page.