Updating javascript object property?

后端 未结 8 1847
盖世英雄少女心
盖世英雄少女心 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:55

    push is a method of Arrays that adds a new item to an array.

    If you want to replace the value then:

    skillet.person.name = { … };
    

    If you want to store multiple (full) names in the object, then you'll need the property to hold an array of objects instead of a single object.

提交回复
热议问题