Here’s a few examples of some popular code challenges along with my solutions.

Random Number Guessing Game

This was a class assignment from The Iron Yard. This is a good challenge for beginners, it combines the use of math, loops and prompts. This one gave you a prompt on page load, click rerun to start the game over (button appears on hover of “Result” section).

See the Pen JavaScript Random Number Guessing Game by Thomas Weld (@thomasweld) on CodePen.



This one is a classic, I’ve been asked to write a FizzBuzz program on multiple interviews.

See the Pen FizzBuzz by Thomas Weld (@thomasweld) on CodePen.


Fibonacci Sequence with JavaScript

For more information on what the Fibonacci Sequence is, click here.

See the Pen Fibonacci Sequence JavaScript by Thomas Weld (@thomasweld) on CodePen.


Verify a Prime Number with JavaScript

Using math to verify a prime number. I also used this exercise to refresh my JavaScript skills around forms. I threw in a ternary operator for good measure.

See the Pen Check Prime Number JavaScript by Thomas Weld (@thomasweld) on CodePen.