title: Mapping JavaScript Object property with another property in same JavaScript Object
body: <p>I have a JavaScript Object and I'm looking forward to <code>map()</code> it's <code>Id</code> with another <code>id</code> in the same JavaScript Object, my JavaScript Object Schema is</p>
  
  <pre><code>var items = [
    {
      BossId: "03",
      DateOfBirth: "1966-09-27T00:00:00",
      FamilyName: "Montejano",
      Gender: "Unspecified",
      GivenName: "Trinh",
      Id: "08",
      Title: "Tech Manager"
    },
    {
      BossId: "00",
      DateOfBirth: "1927-01-29T00:00:00",
      FamilyName: "Fetzer",
      Gender: "Unspecified",
      GivenName: "Winfred",
      Id: "00",
      Title: "CEO"
    },
    {
      BossId: "01",
      DateOfBirth: "1927-08-20T00:00:00",
      FamilyName: "Dandrea",
      Gender: "Male",
      GivenName: "Erich",
      Id: "02",
      Title: "VP of Marketing"
    },
    {
      BossId: "01",
      DateOfBirth: "1929-02-07T00:00:00",
      FamilyName: "Nisbet",
      Gender: "Male",
      GivenName: "Reinaldo",
      Id: "03",
      Title: "VP of Technology"
    },
    {
      BossId: "01",
      DateOfBirth: "1932-06-13T00:00:00",
      FamilyName: "Bufford",
      Gender: "Unspecified",
      GivenName: "Alleen",
      Id: "04",
      Title: "VP of HR"
    },
    {
      BossId: "02",
      DateOfBirth: "1936-09-26T00:00:00",
      FamilyName: "Klopfer",
      Gender: "Female",
      GivenName: "Kristyn",
      Id: "05",
      Title: "Director of Marketing"
    },
    {
      BossId: "01",
      DateOfBirth: "1937-11-23T00:00:00",
      FamilyName: "Duhon",
      Gender: "Male",
      GivenName: "Sophie",
      Id: "01",
      Title: "Tech Manager"
    },
    {
      BossId: "03",
      DateOfBirth: "1948-04-05T00:00:00",
      FamilyName: "Mirabal",
      Gender: "Female",
      GivenName: "Suanne",
      Id: "07",
      Title: "Tech Manager"
    },
    {
      BossId: "04",
      DateOfBirth: "1966-10-13T00:00:00",
      FamilyName: "Maslowski",
      Gender: "Unspecified",
      GivenName: "Norah",
      Id: "09",
      Title: "Tech Manager"
    },
    {
      BossId: "06",
      DateOfBirth: "1967-08-25T00:00:00",
      FamilyName: "Redford",
      Gender: "Female",
      GivenName: "Gertrudis",
      Id: "10",
      Title: "Tech Lead"
    },
    {
      BossId: "06",
      DateOfBirth: "1968-12-26T00:00:00",
      FamilyName: "Tobey",
      Gender: "Male",
      GivenName: "Donovan",
      Id: "11",
      Title: "Tech Lead"
    },
    {
      BossId: "09",
      DateOfBirth: "1969-10-16T00:00:00",
      FamilyName: "Vermeulen",
      Gender: "Male",
      GivenName: "Rich",
      Id: "12",
      Title: "Trainer Lead"
    },
    {
      BossId: "09",
      DateOfBirth: "1972-10-16T00:00:00",
      FamilyName: "Knupp",
      Gender: "Male",
      GivenName: "Santo",
      Id: "13",
      Title: "HR Manager"
    },
    {
      BossId: "12",
      DateOfBirth: "1974-03-23T00:00:00",
      FamilyName: "Grooms",
      Gender: "Female",
      GivenName: "Jazmin",
      Id: "14",
      Title: "Trainer"
    },
    {
      BossId: "13",
      DateOfBirth: "1978-08-25T00:00:00",
      FamilyName: "Cheeks",
      Gender: "Female",
      GivenName: "Annelle",
      Id: "15",
      Title: "Recruiter"
    },
    {
      BossId: "15",
      DateOfBirth: "1979-08-21T00:00:00",
      FamilyName: "Harshaw",
      Gender: "Unspecified",
      GivenName: "Eliza",
      Id: "16",
      Title: "Trainer"
    },
    {
      BossId: "08",
      DateOfBirth: "1980-02-09T00:00:00",
      FamilyName: "Broaddus",
      Gender: "Unspecified",
      GivenName: "Xiomara",
      Id: "17",
      Title: "Senior Software Developer"
    },
    {
      BossId: "11",
      DateOfBirth: "1981-09-08T00:00:00",
      FamilyName: "Jungers",
      Gender: "Unspecified",
      GivenName: "Erminia",
      Id: "18",
      Title: "Software Developer"
    },
    {
      BossId: "10",
      DateOfBirth: "1984-03-18T00:00:00",
      FamilyName: "Moffatt",
      Gender: "Female",
      GivenName: "Maria",
      Id: "19",
      Title: "Software Developer"
    },
    {
      BossId: "10",
      DateOfBirth: "1990-09-24T00:00:00",
      FamilyName: "Grimaldo",
      Gender: "Female",
      GivenName: "Tammera",
      Id: "20",
      Title: "Senior Software Developer"
    },
    {
      BossId: "10",
      DateOfBirth: "1992-06-18T00:00:00",
      FamilyName: "Das",
      Gender: "Female",
      GivenName: "Sharyl",
      Id: "21",
      Title: "Software Developer"
    },
    {
      BossId: "08",
      DateOfBirth: "1993-11-15T00:00:00",
      FamilyName: "Harlan",
      Gender: "Unspecified",
      GivenName: "Shan",
      Id: "22",
      Title: "UI Developer"
    },
    {
      BossId: "11",
      DateOfBirth: "1997-03-23T00:00:00",
      FamilyName: "Almeida",
      Gender: "Female",
      GivenName: "Mariah",
      Id: "23",
      Title: "QA Tester"
    },
    {
      BossId: "11",
      DateOfBirth: "1998-11-10T00:00:00",
      FamilyName: "Kerfien",
      Gender: "Male",
      GivenName: "Darnell",
      Id: "24",
      Title: "QA Tester"
    },
    {
      BossId: "11",
      DateOfBirth: "2004-04-22T00:00:00",
      FamilyName: "Vierra",
      Gender: "Female",
      GivenName: "Janell",
      Id: "25",
      Title: "QA Tester"
    }
  ];
  </code></pre>
  
  <p>I'd like to create a function that when provided with a <code>BossId</code> will output a list of employees who report to that boss. For example, the output for <code>BossId</code> <code>'03'</code> would be</p>
  
  <pre><code>[
    {
      "BossId": "03",
      "DateOfBirth": "1966-09-27T00:00:00",
      "FamilyName": "Montejano",
      "Gender": "Unspecified",
      "GivenName": "Trinh",
      "Id": "08",
      "Title": "Tech Manager"
    },
    {
      "BossId": "03",
      "DateOfBirth": "1948-04-05T00:00:00",
      "FamilyName": "Mirabal",
      "Gender": "Female",
      "GivenName": "Suanne",
      "Id": "07",
      "Title": "Tech Manager"
    }
  ]
  </code></pre>
  
  <p>What I've tried:</p>
  
  <pre><code>items.map(res =&gt; ({
    ...res.Users,
    Users: items
      .filter(id =&gt; id.Id == id.BossId)
      .map(({ Id, ...rest }) =&gt; rest)
    }))
  </code></pre>