jsartisan / frontend-challenges

FrontendChallenges is a collection of frontend interview questions and answers. It is designed to help you prepare for frontend interviews. It's free and open source.
https://frontend-challenges.com
21 stars 4 forks source link

18 - flatten #25

Open marks0351 opened 4 months ago

marks0351 commented 4 months ago

index.js

export function flatten(arr, depth = 1) {
  // write your logic here
  return arr.flat(depth)
}