As I ponder the complexity of my question, I find myself wondering how to condense an array by merging adjacent strings while keeping objects intact. For example:
array = ["I","want","to",[Obj],"come","together"]
The desired output would be:
["I want to", [Obj], "come together"];
I have a hunch that array.reduce()
could be the solution, but I still need to fully grasp how that function works.