JavaScript Basics Assessment

Before continuing with the lessons go ahead and attempt the following assessment. These will be a good way to test your understanding of the knowledge you just gained.

JavaScript Basics

Instructions:

  • Create a new folder in your prework repo called JavaScript_Basics_Assessment.
  • Complete the following activities in separate files named after each activity, activity-2.js, etc.
  • When you have completed the activities push the files to your GitHub Repo.

Activity 1: JavaScript Math Quiz:

Using JavaScript, compute the following:

  1. The product of 9 and 9
  2. The quotient of 56 and 12
  3. The remainder of 281 divided by 9
  4. 18 divided by 0
  5. The sum of string 56 and string 92
  6. Using any comparison operator you wish on the numbers 42 and 52, make it evaluate to false.

Activity 2: JavaScript Variables, Alerts, Prompts, and Conditionals:

  1. Grab a user input using a prompt() and store it in a variable.
  2. Add a conditional statement where if the variable's length is greater than 4, we alert the user that their name is greater than four characters.
  3. Otherwise, alert that their name is less than four characters.

Activity 3: JavaScript Arrays and Loops:

  1. Start off by creating an array with three student names.
  2. Create a loop that will prompt the user for three more names.
  3. After every user input, store the new name into the array.
  4. Create a new loop that will iterate through the array and console log each element of the array.