Replace all the values of an object in JavaScript

Let's assume that we declare the following object:

javascript
let team = {
    
    'Steve': 'Apple',
    'Bill':  'Microsoft',
    'Jeff':  'Amazon',
    'Elon':  'Tesla' 
    
}

Each CEO belongs to a different company.

As in the future they will work for Erik Inc., we need to change each value of the object:

javascript
Object.keys(team).forEach(name => team[name] = 'Erik Inc.');

console.log(team);
// {Steve: 'Erik Inc.', Bill: 'Erik Inc.', Jeff: 'Erik Inc.', Elon: 'Erik Inc.'}

My future looks promising. 😎

Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.