Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 1.63 KB

README.md

File metadata and controls

37 lines (29 loc) · 1.63 KB

Intro JavaScript

Control Flow

Objectives
Apply knowledge of methods and types to solve small exercises
Play with control flow structures

Please try the following exercises in the Chrome console.

First complete all exercises from the JS Primitives lesson.

Exercises

  • Practice using prompt, confirm, and alert try the following. You may want to look them up on MDN.

    • Ask the user for the their firstName. Then alert it.
    • Ask the user "have we met before?". If true then respond "nice to meet you".
  • Get the temperature from the user and alert it back in Celsius.

  • Confirm if a user has three friends? Use a loop and prompt to collect the names of the friends. Alert back the names of the friends.

  • Prompt the user to give a word. Then alert back the number of vowels.

  • Write a loop to solve the following riddle. I am a number between 2 and 100. I am even and a multiple of 3. I end in 2. My digits sum to 9.

  • Hard: Generate a random number between 1 and 100, an integer and not a float. Prompt the user to guess the number. Continue prompting the user for a guess using a loop, telling them each time if the number is lower or higher. Alert correct when they guess the number.

  • Super Challenge: Given an array of friends

    var friends = [
                    "larry",
                    "moe",
                    "curly",
                    "huey",
                    "louie",
                    "dewey"
                    ]
    

    write a loop to alert them in some random order.