Answer the question
In order to leave comments, you need to log in
How to form an object with a new structure based on the current one?
Hello.
Initial data:
const data = [
{name: "Аня", count: 21},
{name: "Петя", count: 40},
{name: "Петя", count: 7},
{name: "Аня", count: 4},
{name: "Никита", count: 49}
]
const newData = {
"Аня": [
{name: "Аня", count: 21},
{name: "Аня", count: 4}
],
"Петя": [
{name: "Петя", count: 40},
{name: "Петя", count: 7}
],
"Никита": [
{name: "Никита", count: 49}
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question