Interview Question

Anjali Gurjar - Feb 5 - - Dev Community

const obj={
brand:'Apple',
color:'Red',
price:'300'
}
Object.keys(obj).forEach((key)=>{
const value=obj[key]

    const firstvalue=key.charAt(0).toUpperCase()+key.slice(1);
   obj[key]=firstvalue



}
Enter fullscreen mode Exit fullscreen mode

)

const obj={
brand:'Apple',
color:'Red',
price:'300'
}

const updateDb={}
Object.keys(obj).forEach((key)=>{
const value=obj[key]
const firstvalue=key.charAt(0).toUpperCase()+key.slice(1);
console.log(firstvalue)

    updateDb[key]=firstvalue



}
Enter fullscreen mode Exit fullscreen mode

)

   console.log(updateDb)
     return updateDb
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .