function flatFormat(arr, result = []) { for (let i; i < arr.length; i++) { if (Array.isArray(arr[i])) { flatFormat(arr[i], result); } else { result.push(arr[i]); } } return result; }