Can anyone show me an iterative solution for the following problem? I solved it recursively but struggled with an iterative solution. (Facebook Technical Interv
How about this?
inp = [1, {a: 2}, [3], [[4, 5], 6], 7] out = inp; while(out.some(Array.isArray)) out = [].concat.apply([], out); document.write(JSON.stringify(out));