Home / Javascript Tips Generated By ChatGPT / Using Array.flat to Flatten Arrays in Javascript Flatten nested arrays into a single array. Source Code let nested = [1, [2, 3], [4, [5, 6]]]; console.log(nested.flat(2)); // Specify depth