How to avoid the emptiness error with spread?
How can I avoid a void error when unfolding multiple arrays?
const arr1 = [a, b, c] const arr2 = [g, g, t, y] const arr3 = [1, 2, 3, 4] const allArr = [...arr1, ...arr2, ...arr3]
[arr1, arr2, arr3] .filter (Array.isArray) .flat ()Anonymous
empty is it null? empty array  can be expanded
a1 = [2,43,5]
a2 = 
// (3) [2, 43, 5]
if null / undefined, then yes fence a bunch of checksAnonymous
const allArr = [...arr1, ...(arr2 || ), ...(arr3 || )];
Not that the most efficient solution, but the shortest.Anonymous
To place the code, please use CodePen or similar tool. Thanks you!