Skip to content

Latest commit

 

History

History

README.md

Workshop 1

By the end of these exercises you should be able to understand the following concepts:

  1. String Manipulation
  2. Basic operations on numbers
  3. Using boolean values to change code paths
  4. If-statements

Beginner Exercises

Start here if the material in the lecture was confusing or you want to brushup on your skills.

  1. Create a program that tells a user the largest value between two input values. The skeleton code is located in max.html.

  2. Write a program that takes a number in Fahrenheit and converts to Celsius. The file temp.html contains the starting point and more directions.

  3. FizzBuzz! Write a program that, for any number input, prints out the word "Fizz" for multiples of 3, "Buzz" for multiples of 5, "FizzBuzz" for multiples of 3 and 5, or the number if none of the other conditions are met. Check out fizzbuzz.html for all of the details.

  4. Create a function that takes a single character and returns whether or not the character is a vowel.

  5. Calculate the circumference and area of a circle. You might need to look up how to get the value of PI in javascript. Resist the urge to google 'Javascript circle circumference.'.

  6. Guessing game. Ask the user to guess a secret number. The user will have two tries to guess the number. After each guess, let the user know if it needs to be higher or lower. Once all guesses are gone, the game is over.

  7. Single word pig-latin. Write a program that takes a single word from the user and converts it to pig-latin. Pig-latin takes the first letter of a word, moves it to the end, then adds "ay." For example, "My name is Jonas", would be converted to "Ymay amenay isway Onasjay". For the purposes of this exercise, concentrate on one word input.

Intermediate Exercise

Start here if you already know if-statements and are comfortable writing functions.

Create a single game of blackjack. Rules are as follows...

  1. One player versus a dealer. The app should deal the cards to a player and the dealer.
  2. The player should see the cards and be given the option to hit or stand (we won't worry about splitting or doubling down).
  3. After choosing, if the player's hand is better than the dealers without going over 21, the player wins.
  4. Start the user off with 1000 in credits and allow them to wager on each hand. If they lose, subtract the amount of money from their account.
  5. If the user runs out of money, end the game.

Use the blackjack.html file as a starting point.

Advanced Exercise

Try this on if you are comfortable with all conditional statements, arrays, functions and objects.

  1. Tic-Tac-Toe