dev1 – 09 JS control flow problem set

There are six pairs (plus a bonus) of HTML/JS files to be completed and submitted.

  1. How are you really feeling? Write a program that asks “How are you feeling?” Then have the program immediately ask again, “How are you really feeling?” Have the program compare the statements. If the statements match, then send a message, “Wow so you really feel insert feeling” If they don’t match send a message, “Ok so you’re not sure if you’re firstFeeling or secondFeeling.”
    1. feeling.html / feeling.js
  2. How fast were you running? Write a program that asks for how many miles a person ran and how many minutes the run took. If either answer was not a number, then let the user know they should try again. If both answers are numbers calculate and report the MPH the user averaged.
    1. running.html / running.js
  3. What’s the weather? Write a program that asks a user what the weather looks like today. Using a switch statement, have your program respond with advice to the following answers, “rain”, “cloudy”, “sunny”, “cold”,  “hot”, and for all other answers let the user know, “I don’t have any advice for you today, sorry.”
    1. weather.html / weather.js
  4. FizzBuzz – This is a classic loop problem for which the solution exists in a myriad of languages and methods. Write a program that console.log’s the numbers 1 to 100. Except log for numbers divisible by 3 log “Fizz”, numbers divisible by 5 log “Buzz”, and numbers divisible by both 3 and 5 log “FizzBuzz”.
    1. fizzbuzz.html / fizzbuzz.js
  5. Guessing Game between 1 and 100 – Write a program that generates a random whole number between 1 and 100 and then prompts a user to guess the number. If the guess is less than the answer given, prompt the user with the hint that the number is lower than the one guessed. If the guess is higher than the answer given, prompt the user with the clue that the number is higher than the one guessed. If the user guesses correctly, alert the user that they have guessed the answer. Be sure to report the correctly guessed number in the alert.
    1. guess.html / guess.js
  6. Falling down the stairs – Take the phrase “falling down the stairs” and write a program that console logs the phrase one letter per line, but for each line add one additional space is in front of each letter. This will give the appearance of the letters in the phrase looking like a staircase.
    1. stairs.html / stairs.js
  7. ***BONUS*** Climbing Up the Mountain – Take the phrase, “Climbing up the Mountain” and log one letter per line but in reverse. Also the last line should have one space in front, the second to last two spaces, etc. This will give the impression of a the letters going up to a peak. Hint: You will need to employ new string methods.
    1. mountain.html / mountain.js

Leave a comment

Your email address will not be published. Required fields are marked *