let arr = [
{
id: 1,
firstName: 'John',
lastName: 'Smith'
},
{
id: 2,
firstName: 'Brady',
lastName: 'Dennis'
},
{
id: 3,
firstName: 'Sandoval',
lastName: 'Pratt'
}
]
let arr = [
{
id: 1,
firstName: 'john',
lastName: 'smith'
},
{
id: 2,
firstName: 'brady',
lastName: 'dennis'
},
{
id: 3,
firstName: 'sandoval',
lastName: 'pratt'
}
]
const newArr = arr.map(function({ ...n }) {
return this.reduce((acc, k) => (acc[k] = acc[k].toLowerCase(), acc), n);
}, [ 'firstName', 'lastName' ]);
const keys = [ 'firstName', 'lastName' ];
arr.forEach(n => keys.forEach(k => n[k] = n[k].toLowerCase()));
let arr = [
{
id: 1,
firstName: 'John',
lastName: 'Smith'
},
{
id: 2,
firstName: 'Brady',
lastName: 'Dennis'
},
{
id: 3,
firstName: 'Sandoval',
lastName: 'Pratt'
}
];
arr.forEach(function (item) {
item.firstName = item.firstName.toLowerCase();
item.lastName = item.lastName.toLowerCase();
});