-3

Example:

this.themes.basic = {
  background: "black",
  specialThings: {
    border: "1px
  }

}

this.themeObj: {
  background: "black",
  specialThings: {}
}

I need a function that scans this.themeObj and replaces missing values with the value of this.themes.basic. It also should scan child's of the Object. PS: pls don't use eval if it is possible

Thanks

Ori Drori
  • 183,571
  • 29
  • 224
  • 209
Proxtx
  • 3
  • 2

1 Answers1

-1

You can try with:


let themes = {
  background: "black",
  specialThings: {
    border: "1px"
  }
}

let themeObj = {
  background: "black",
  specialThings: {}
}

const object3 = {...themeObj, ...themes };

Matteo Ponzo
  • 47
  • 1
  • 3