Skip to content

cattmampbell/javascript-kitchen-sink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Objectives

  • Practice using the fundamentals of JavaScript that were explored in lecture.
  1. Create a new project folder and connect it to a github repository. Copy this README.md file into it.
  2. Create an index.html file and an app.js file and link the two together.
  3. Create a variable that contains your name as a value. Name the variable appropriately.
  4. Create a constant that contains the number of states in the U.S. and name it appropriately.
  5. Compute the result of adding 5 and 4 and store it in an appropriately named variable.
  6. Write some code so that if your name starts with a letter after L, you display an alert that says "Back of the line!". Otherwise, you should display an alert that says "Next!".

Hint:

  1. Add comments to your code to document its functionality.
  2. Write a function called sayHello that displays an alert that says Hello World!
  3. Call the sayHello function.
  4. Write a function called checkAge that takes two arguments: one for a name and one for an age. If the age is less than 21, display an alert that says "Sorry {{{toMarkdown}}}name{{{toMarkdown}}}, you aren't old enough to view this page!"
  5. Call the checkAge function 4 times with the following people: Charles who is 21, Abby who is 27, James who is 18, and John who is 17.
  6. Create an array of your favorite vegetables and name it accordingly.
  7. Use a loop to display each of your favorite vegetables to the developer console.
  8. Create an array of 5 objects that contain name and age properties. Make up names and ages for each object, making sure some are younger than 21 and some are 21+.
  9. Use a loop to call the checkAge function for each object in the array, passing the object's name and age as arguments.
  10. Create a function called getLength that takes any word as an argument. The function should return the number of characters in the string.
  11. Call the getLength function, passing 'Hello World' as the argument. Store the returned result of that function in a variable.
  12. Check the number in the variable from the previous objective. If the number is even, display 'The world is nice and even!' in the developer console. Otherwise if the number is odd, display 'The world is an odd place!' in the developer console.

Releases

No releases published

Packages

No packages published