function flatArr(arr){

let flat = []

for(let value of arr){
  if(Array.isArray(value)){
		flat = flatArr([...flat, ...flatArr(value)])
	}else{
  	flat.push(value)
  }
}
return flat

	
}


console.log(flatArr([1,[2,[3,4,5],6, 7]]))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: