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.
Review the first few sections of the AirBnB Javascript Style Guide. For example, be sure to use let and const, not var.
If you haven’t already, download and install the Chrome Browser.
Next, login to JSFiddle (creating an account if you haven’t already).
Check the settings pane to make sure the console window is displayed in the editor, and the layout is to your liking (I prefer “Tabs (rows)”).
To make the result window dark for your new JSFiddle, add the following to the CSS pane:
body { background-color: #1f2227; }
You may also want to reduce the height of the result window, so that more space is provided for the Javascript window.
For this practice WOD, solve Problem 1 from Project Euler. Note that you do not have to register with the Project Euler site and submit your answer (though if you want to, you can).
Ready? Let’s begin:
Start your timer.
Create a Javascript function called “projectEulerOne”. The function should compute and return the answer. Print the value returned by the function out to the console.
Informally test your program by running it and inspecting the output.
Press the “save” button to create a URL to refer to your code.
Stop your timer and record your time. Be sure to record the time associated with every attempt at this WOD, 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
Once you’ve finished trying the WOD for the first time, watch me do it.
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.
By the time and date indicated on the Schedule page, submit this assignment via Laulima.
Your submission should contain:
A link to the JSFiddle. Make sure you include the complete URL so that I can click on it in my mailer.
The number of times you have attempted this assignment so far, and for each time, how long it took you.
You will receive full credit for this practice WOD as long as you have attempted it at least once and submitted your work on Laulima with all required data before the due date. Your code does not have to run perfectly for you to receive full credit.