Flatten a nested array of arbitrary depth (without Array.prototype.flat) · InterviewLane