Instructions

  • 1. Your final score will reflect your grasp of the concepts—approach each question with precision.
  • 2. Thoroughly review each solution before proceeding to ensure full understanding.
  • 3. Final results will be available after submission to provide insights into areas for further improvement.
  • 4. Maintain academic integrity—plagiarism undermines learning and professional growth.
  • 5. Once submitted, responses are final, so ensure you’re confident in your answers.
  • 6. These challenges are designed to test practical knowledge; apply your skills as you would in real-world scenarios.

All Problems

Question

Action

Which array method executes a provided function once for each array element?

View

What is the return value of forEach()?

View

Which method transforms an array by calling a provided function on each element and returns a new array?

View

What is the result of the following code?

View

Which method can be used to create a new array with elements that pass a test defined in a function?

View

What does the following code return?

View

What is the result of calling the reduce() method on an array?

View

What is the output of the following code?

View

Which method can be used to check if all elements in an array pass a specific test?

View

Which method can be used to check if at least one element in an array passes a specific test?

View

Which array method executes a provided function once for each array element?

map()
forEach()
filter()
reduce()

What is the return value of forEach()?

A new array
A single value
undefined
The first element of the array

Which method transforms an array by calling a provided function on each element and returns a new array?

reduce()
forEach()
map()
filter()

What is the result of the following code?

var arr = [1, 2, 3]; var doubled = arr.map(x => x * 2); console.log(doubled);

[1, 2, 3]
[2, 4, 6]
[3, 6, 9]
undefined

Which method can be used to create a new array with elements that pass a test defined in a function?

map()
reduce()
filter()
forEach()

What does the following code return?

var arr = [10, 20, 30, 40]; var result = arr.filter(x => x > 25); console.log(result);

[30, 40]
[10, 20, 30]
[25, 30, 40]
undefined

What is the result of calling the reduce() method on an array?

A new array
A single value
A filtered array
A sorted array

What is the output of the following code?

var arr = [1, 2, 3, 4]; var sum = arr.reduce((total, num) => total + num); console.log(sum);

10
6
24
12

Which method can be used to check if all elements in an array pass a specific test?

every()
some()
filter()
forEach()

Which method can be used to check if at least one element in an array passes a specific test?

map()
every()
some()
reduce()