JavaScript · Junior · Question 73 of 75

What does [1, [2, [3]]].flat() return?

Explanation

By default flat flattens one level. Pass a depth (flat(2)) or Infinity to flatten completely. flatMap maps then flattens one level.

Further reading

Problem with a question

JavaScript · Junior · question 73

Test yourself

Take the JavaScript · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz