Here's the arrays:
const firstArr = [
  {
    id: 1,
    code: '1'
  },
  {
    id: 2,
    code: '2'
  },
  {
    id: 3,
    code: '3'
  },
]
const secondArr = [
  {
    id: 1,
    code: '1',
    bool: true,
  },
  {
    id: 2,
    code: '2',
    bool: true,
  },
]
Desired result is:
const overwrittenArr = [
  {
    id: 1,
    code: '1',
    bool: true,
  },
  {
    id: 2,
    code: '2',
    bool: true,
  },
  {
    id: 3,
    code: '3'
  },
]
secondArr should overwrite the firstArr by the code value, if it's exact the same value as in the firstArr, then it should be replaced with the object from the secondArr. I've tried to do that with filter, but had no success.
 
     
     
    