如何将数组对象的小写字母转换为大写字母


[
{ name: 'Rahul Patel' },
{ name: 'Karan Patel' },
{ name: 'Shubham Tayal' },
{ name: 'rahul patel' },
{ name: 'Prakash shah' }
]

我不是javascript开发人员,但可能是这样的:

employes.forEach(element => element.name = element.name.toUpperCase());

const employes=[{name:'Rahul Patel'},{name:'Karan Patel'},{name:'Shubham Tayal'},{name:'rahul patel'},{name:'Prakash shah'}]

const toUpper = employes.map(o => ({ name: o.name.toUpperCase() }));
console.log(toUpper);

相关内容

  • 没有找到相关文章