check

Prep Course Quiz

Need the Prep Course?

Take this short quiz to find out!

Click the button below to start.

Start

Question 1 of 7

What is the correct way to access the last element in an array?

A

sampleArray.indexOf(sampleArray.length)

B

sampleArray[sampleArray.length - 1]

C

sampleArray[sampleArray.length]

D

sampleArray.last

Question 2 of 7

Which is a correct way to test whether two variables representing numbers, numOne and numTwo, are equal?

A

numOne.equals(numTwo)

B

numOne = numTwo

C

numOne === numTwo

D

Number.isEqual(numOne, numTwo)

Question 3 of 7

How would you find the sum of all items in an array in JavaScript?

A

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.

B

Use a built-in function in JavaScript called "sum"

Question 4 of 7

 

What is the following function's return value?

A

Undefined

B

25

Question 5 of 7

How would you log `red` to the console using this object?

 

A

console.log(car('color'));

B

console.log(car.color);

C

console.log(car('red'));

D

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?

A

Use an array only

B

Use an object only

C

Use an array with several objects in the array

D

Use an object with one array inside

Question 7 of 7

 

What is the result of the following code?

A

Hello

B

Hello Bob

C

Hello Sue

D

Hello Undefined

Confirm and Submit