Question 1 of 10
Quiz
Back to lesson
JavaScript Arrays Mastery Quiz
Check your understanding of array structure, mutation, copying, transformations, searching, sorting, modern copying methods, asynchronous collection, and grouping.
10 questions
~8 min
Intermediate
Knowledge check
JavaScript Arrays Mastery Quiz
Check your understanding of array structure, mutation, copying, transformations, searching, sorting, modern copying methods, asynchronous collection, and grouping.
- Stuck? Each question has an optional hint.
- Skip a hard question and review it before your results.
- Questions and answer options can shuffle between attempts.
You can retake this quiz whenever you like.
0:00
Trace the operation named in the question and ask what it returns or mutates.
A hole is absent at that index. A read still yields undefined, but property existence and some array-method behavior can distinguish it.
Review this lesson
Question 2 of 10
Which operation changes the original array?
Trace the operation named in the question and ask what it returns or mutates.
splice edits the receiver. The other listed operations create or return results without directly changing the receiver.
Review this lesson
Question 3 of 10
What does [...items] copy?
Trace the operation named in the question and ask what it returns or mutates.
Array spread creates a new outer array while preserving the element values; nested objects are not recursively cloned.
Review this lesson
Question 4 of 10
Which method is intended to produce one transformed result per visited element?
Trace the operation named in the question and ask what it returns or mutates.
map constructs a new array from callback results, preserving the visited element count and order.
Review this lesson
Question 5 of 10
What is the optional second argument to reduce?
Trace the operation named in the question and ask what it returns or mutates.
The second argument supplies the accumulator’s initial value and makes empty-input cases predictable when an identity value is appropriate.
Review this lesson
Question 6 of 10
Which equality algorithm does includes use?
Trace the operation named in the question and ask what it returns or mutates.
Array.prototype.includes compares with SameValueZero, so for example NaN can be found by includes.
Review this lesson
Question 7 of 10
Why can [10, 2, 30].sort() surprise you?
Trace the operation named in the question and ask what it returns or mutates.
Without a comparator, Array.prototype.sort compares elements according to string conversion/order rather than numeric magnitude.
Review this lesson
Question 8 of 10
Which method replaces one array position without mutating the receiver?
Trace the operation named in the question and ask what it returns or mutates.
with returns a new array with the selected position replaced and leaves the original array unchanged.
Review this lesson
Question 9 of 10
What does Array.fromAsync return?
Trace the operation named in the question and ask what it returns or mutates.
Array.fromAsync is asynchronous and returns a Promise for the resulting array.
Review this lesson
Question 10 of 10
What is a useful distinction between Object.groupBy and Map.groupBy?
Trace the operation named in the question and ask what it returns or mutates.
Object.groupBy converts callback results to property keys; Map.groupBy keeps them as Map keys.
Review this lesson
Quiz results
0/0
Review
-
What is the key difference between a hole and an explicit undefined element?Hint used
-
Which operation changes the original array?Hint used
-
What does [...items] copy?Hint used
-
Which method is intended to produce one transformed result per visited element?Hint used
-
What is the optional second argument to reduce?Hint used
-
Which equality algorithm does includes use?Hint used
-
Why can [10, 2, 30].sort() surprise you?Hint used
-
Which method replaces one array position without mutating the receiver?Hint used
-
What does Array.fromAsync return?Hint used
-
What is a useful distinction between Object.groupBy and Map.groupBy?Hint used