Object.assign attribute copy

var obj = {
  name: "obj",
  fn: {
    add: true,
    edit: true
  }
}

var page1 = {
  name: "page1",
  fn: {
    edit: false
  }
}

var config = Object.assign({}, obj, page1)
// {name: "page1", fn: {edit: false}}

how can I override only one value of edit?
achieves the final result
{name: "page1", fn: {add:true, edit: false}}

Apr.19,2021

if there are many such attributes, it is recommended to make a deep copy

if this is the only one, it is recommended to write:

var obj = {
  name: 'obj',
  fn: {
    add: true,
    edit: true
  }
}

var page1 = {
  name: 'page1',
  fn: {
    edit: false
  }
}

var config = Object.assign({}, obj)
config.fn.edit = page1.fn.edit;
// {name: 'page1', fn: {add: true, edit: false}}

  Objct.assign  

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e90640-46017.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e90640-46017.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?