title: Remove elements from one array and add them to a new array
body: <p>I have an array of objects containing world countries with some additional information e.g.</p>
  <pre><code>countries = [
    {
      flag: 'assets/flags/angola.svg',
      code: 'AGO',
      name: 'Angola',
      regions: [{
        name: 'Luanda'
      }]
    },
    {
      flag: 'assets/flags/albania.svg',
      code: 'ALB',
      name: 'Albania',
      regions: [{
        name: 'Korça'
      }, {
        name: 'Tirana'
      }, {
        name: 'Gjirokastër'
      }]
    }...
  </code></pre>
  <p>I want to extract three of my favorite countries into a new array while removing them from the original array so I end up with two arrays one for my favorite countries and one for the rest of the countries.</p>
  <p>I managed to achieve this the following way:</p>
  <pre><code>public createCountriesList(allCountries: Country[]) {
  
  let topCountries: Country[] = [];
  let restOfCountries: Country[];
  
  allCountries.forEach((element) =&gt; {
    switch (element.code) {
      case 'HRV':
        topCountries.push(element);
        break;
      case 'AT':
        topCountries.push(element);
        break;
      case 'GER':
        topCountries.push(element);
        break;
    }
  });
  
  restOfCountries = allCountries.filter((c) =&gt; {
    return !topCountries.includes(c);
  });}
  </code></pre>
  <p>It works, but I was wondering if there is a more elegant way to do this?</p>