Intern — Middle
Normalization of user array into an object with id keys
livecode
Task condition
Given a list of objects, each describing a user. Convert this list into a dictionary structure where each key is a unique user identifier (id), and the value is the original object with full user information.
const users = [
{ id: 1, age: 16, salary: 200, name: 'Andrey', roles: ['front'] },
{ id: 2, age: 21, salary: 250, name: 'Vasya', roles: ['back'] },
{ id: 3, age: 30, salary: 400, name: 'Sergey', roles: ['front', 'lead'] },
{ id: 4, age: 25, salary: 360, name: 'Dmitriy', roles: ['manager'] },
{ id: 5, age: 50, salary: 420, name: 'Max', roles: ['back', 'lead'] },
];