Recall & Review
beginner
What does the
push() method do in an array?It adds one or more elements to the end of an array and returns the new length of the array.
Click to reveal answer
beginner
How do you remove the first element from an array?
Use the
shift() method. It removes the first element and returns it, shifting all other elements down by one index.Click to reveal answer
intermediate
What is the difference between
map() and forEach()?map() creates a new array by applying a function to each element, while forEach() simply runs a function on each element without returning a new array.Click to reveal answer
beginner
How can you find the index of a specific element in an array?
Use the
indexOf() method. It returns the first index at which the element can be found, or -1 if it is not present.Click to reveal answer
intermediate
What does the
filter() method do?It creates a new array with all elements that pass a test implemented by a provided function.
Click to reveal answer
Which method adds elements to the end of an array?
✗ Incorrect
The push() method adds elements to the end of an array.
What does the
pop() method do?✗ Incorrect
pop() removes the last element from an array and returns it.
Which method creates a new array by applying a function to each element?
✗ Incorrect
map() applies a function to each element and returns a new array.
How do you find the position of an element in an array?
✗ Incorrect
indexOf() returns the index of the first occurrence of an element.
Which method returns a new array with elements that pass a test?
✗ Incorrect
filter() returns a new array with elements that pass the test function.
Explain how to add and remove elements from the start and end of an array in JavaScript.
Think about methods that work at the beginning and end of the array.
You got /6 concepts.
Describe the difference between
map(), forEach(), and filter() methods.Focus on what each method returns and how they process array elements.
You got /4 concepts.