Skip to content

Latest commit

 

History

History

Mini-Project3.2a

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Mini-Project 3.2a: Loops in Javascript - Laughing machine

Credit to Shift_Up coach Adrian Laurenzi

Become

Welcome to Mini-Project 3.2a!

This mini-project will help you practice writing loops which you learned in the OC course here. Loops are tricky so be prepared to spend a bit of time trying out different things until it works. Don't be afraid to experiment with the code.

Here are some additional practice problems that may be helpful:

Mini-Project Instructions

  1. Copy the loop.html file in SOURCE_FILES to PROJECT_SUBMISSION.

  2. First open the file you just copied (PROJECT_SUBMISSION/loop.html) in your browser and open the Javascript console using Chrome Developer Tools.

  3. In the console output you should see "Starter code is working".

  4. Add code that uses the numLaughs variable to construct a string of repeating "ha"'s. "ha" is repeated the number of times equal to whatever value is assigned to numLaughs. For example, in the code above since the value 4 is assigned, once your code is implemented correctly, the console should output "hahaha". If 2 was entered the output would be "haha", an so on.

  5. Test changing the value of numLaughs to make sure you get the correct string of "ha"'s.

  6. It's also a good idea to check what are called "edge cases". Make sure your code does not produce an error when you set numLaughs = 0.

  7. Extra credit: if you implemented this using a while loop, try implementing it again using a for loop, or vice versa.

  8. Once you are happy with your code, create a new branch (e.g. mini-project3.2a), push your local changes to the branch (new file: loop.html), then go to GitHub and create a new Pull Request and assign to your coach for review.