Need the Prep Course?
Take this short quiz to find out!
Click the button below to start.
Question 1 of 7
What is the correct way to access the last element in an array?
sampleArray.indexOf(sampleArray.length)
sampleArray[sampleArray.length - 1]
sampleArray[sampleArray.length]
sampleArray.last
Question 2 of 7
Which is a correct way to test whether two variables representing numbers, numOne and numTwo, are equal?
numOne.equals(numTwo)
numOne = numTwo
numOne === numTwo
Number.isEqual(numOne, numTwo)
Question 3 of 7
How would you find the sum of all items in an array in JavaScript?
Use a "for loop" to iterate over every item in the array and add that number to a variable you've stored outside of the loop.
Use a built-in function in JavaScript called "sum"
Question 4 of 7
What is the following function's return value?
Undefined
25
Question 5 of 7
How would you log `red` to the console using this object?
console.log(car('color'));
console.log(car.color);
console.log(car('red'));
console.log(car.red);
Question 6 of 7
Imagine you were given the following data - a list of shoes and their prices. Each shoe is named according to their brand, and you only have one pair of shoes for each brand. How could you model this data using JavaScript?
Use an array only
Use an object only
Use an array with several objects in the array
Use an object with one array inside
Question 7 of 7
What is the result of the following code?
Hello
Hello Bob
Hello Sue
Hello Undefined