| 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.
-
Practice using
prompt,confirm, andalerttry the following. You may want to look them up on MDN.- Ask the user for the their
firstName. Thenalertit. - Ask the
user"have we met before?". Iftruethen respond"nice to meet you".
- Ask the user for the their
-
Get the temperature from the user and alert it back in Celsius.
-
Confirm if a user has three friends? Use a loop and
promptto collect the names of thefriends. Alert back the names of thefriends. -
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
2and100. I am even and a multiple of 3. I end in2. My digits sum to9. -
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.