Interview Question

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 } ) 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 } ) console.log(updateDb) return updateDb

Feb 5, 2025 - 12:03
 0
Interview Question

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



}

)

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



}

)

   console.log(updateDb)
     return updateDb