Question 8
Back to Exercise
What is [1, [2, [3, [4]]]].flat()?
- A [1, 2, [3, [4]]] Correct
- B [1, 2, 3, 4]
- C [1, [2, [3, [4]]]]
- D [[1], [2], [3], [4]]
Correct Answer: Option A
flat() removes one level of nesting by default. flat(Infinity) flattens completely.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!