I am looking for a solution on how to reduce the following object:
const myObject = {
first: 'A',
second: {
nestedArr1: ['nestA', 'nestB'],
nestedArr2: ['nestC', 'nestD'],
}
}
to the expected result:
const myObject = {
first: 'A',
nestedArr1: ['nestA', 'nestB'],
nestedArr2: ['nestC', 'nestD'],
}
Thanks in advance!
disclaimer: I was looking for an answer and there are some, but just not using .reduce() (or at least I couldn't find anything.
const, do you want to mutate the object?const(as you have it in your question) is not going to work...results(which must be an array?) and createparsed, but in your question you present it as if you start withmyObjectand want to end withmyObjecthaving a different structure.