For each task, use
looking at the DevTools console, so make sure you have it open!
- For each of the following items, define a variable to hold the value of the item and log it to the console.
stringconsisting of your name
- Your favorite number as an
- Your favorite number as a
arrayconsisting of each of the letters of your first name
arrayconsisting of multiple, different data types. Include at least 3 different data types.
- Add two
stringstogethers. The first string is your first name, and the second string is your last name.
- Add two
integerstogethers to equal the number 100.
arrayyou specified in question 1 (consisting of each of the letters of your first name), log the first item of the array and the last item of the array. When you refer to the last item in the array, try to do it by using the
lengthof the array, rather than manually counting the index of the array.
Log the number of characters in the string ‘supercalifragilisticexpialidocious’ by using the
Log the result of this expression: the length of characters in your first name is equal to the length of characters in your last name.
- Create a conditional statement that does the following:
- If all students are here log a message that says all the students are in class
- Otherwise, log a message that says not everyone is here
Create a for loop that loops through the array of characters in your first name and logs each character.
Create a conditional statement that checks to see if the current
timeis between 7pm and 9:40pm.
Create a conditional statement with multiple conditions that checks to see what the current
dateit is, and logs a unique message for each day of the week.
- Create 4 arrays consisting of the following items. Define variables to store each of the 4 arrays.
- Your favorite 3 restaurants
- Your favorite 3 animals
- Your favorite 3 places in NYC
- Your favorite 3 pokemon
Create an array of arrays consisting of the variables from the previous question. Define a variable to hold this array of arrays.
Loop through your array of arrays and log the value of the each item in the array. You should be looping through 4 things, and each value you log should be an array. For example, the first item logged would be an array containing 3 restaurants, the second item would be an array containing 3 animals, etc.
- Create a nested for loop that loops through the array of your favorite items and logs each individual item. The first loop should log the category of the item, while the nested loop should log each individual item in that category.