Updating javascript object property?

后端 未结 8 1844
盖世英雄少女心
盖世英雄少女心 2021-02-01 03:26

I have a structure like the following:

skillet.person = {
  name: {
    first: \'\',
    last: \'\'
  }, 
  age: {
    current: \'\' 
  },
  birthday: {
    day:         


        
8条回答
  •  后悔当初
    2021-02-01 03:36

    Using ES7+ syntax and a functional approach:

    const new_obj = { ...obj, name: { first: 'blah', last: 'ha'} }
    

提交回复
热议问题