https://medium.com/@rinerkyle97/flattening-an-array-using-recursive-functions-in-javascript-5c80fd5544aa