The flat(depth) method of Array instances creates a new array with all sub-array elements concatenated into it recursively up to the specified depth.