How to flatten an array of arrays of objects with JavaScript? To flatten an array of arrays of objects with JavaScript, we use the flat method. For instance, we write const flattened = [["object1"], ["object2"]].flat(); to return a flattened version of the [["object1"], ["object2"]] array with flat.