✅ – dmikester1 – 19-47 Mar 14
I have 2 objects with the same keys. I want to combine the objects into a single array of objects.
6 Replies
The combined array would look like this:
are these two objects just separate variables? In that case you literally just do
const array = [obj1, obj2]
They are separate variables, I'll see what that does.
unfortunately, that just creates an array with the 2 objects
oh sorry, I misunderstood the question
you want to iterate through the keys of the first object with
Object.keys(obj1).map(key => { ... })
and inside the map you can have the logic to get questions and answersok, that makes sense
This question has an answer! Thank you for helping 😄
If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1085288024121815201
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1085288024121815201