Instructor: Here we have a two-dimensional array of scores, with each element of the outer array being an array itself.
Here we have a function called Average, which takes an array and produces the arithmetic average of the values passed to it. If we wanted to find the average of our scores before ES2019, we need to take our scores and reduce them, iterating through each score and concatenating it to a flat list of scores. If we then log the average, we see that the answer is 96.
ES2019 introduces the flat method on the array prototype which performs the same functionality. If we console log again, we see that it also produces 96. That is to say, the flat method on the array prototype will concatenate subarrays of a multidimensional array.
By default, flat will only concatenate one level deep. If we output scoresByDay.flat with a three-level deep array, we see that it still produces a multidimensional array.
Flat takes in a parameter that can specify how deep you want the flattening to go. If we specify 2, we now see it flattens the entire array.