Which statement flattens myArray when it can be arbitrarily nested?

myArraym can have one level, two levels, or more levels.

Which statement flattens myArray when it can be arbitrarily nested?
A . myArray. reduce ((prev, curr) => prev.concat(curr) [ ]);
B . myArray. join (","). split (",");
C . [ ] .concat {. . .myArray) ;
D . myArray.flat(Infinity);

Answer: A

Subscribe
Notify of
guest
2 Comments
Inline Feedbacks
View all comments
xyz
xyz
2 years ago

Answer is D

LWC
LWC
2 years ago

answer is B