title: Javascript : Sort the array
body: <p>i need to sort the array of people according to who has the most interests in common with Sharon. The person with the most interests matching should be on top. getSortedList() function that sorts the lists of people - whoever has the most similar interests with the 'sharon' object (3 matching interests) should be on top</p>
  
  <pre><code>const interestList = [
    "gaming",
    "driving",
    "football",
    "fishing",
    "painting",
    "cooking",
    "singing",
    "shopping",
    "running",
    "clubbing"
  ];
  
  const people = [
    { name: "Ahmad", interests: ["shopping", "painting", "cooking"] },
    { name: "Betty", interests: ["running", "painting", "football"] },
    { name: "Charlie", interests: ["gaming", "football", "painting"] },
    { name: "Diana", interests: ["fishing", "singing", "driving"] },
    { name: "Ethan", interests: ["gaming", "clubbing", "cooking"] },
    { name: "Farhan", interests: ["cooking", "driving", "fishing"] },
    { name: "Gwen", interests: ["singing", "fishing", "gaming"] },
    { name: "Helen", interests: ["football", "clubbing", "shopping"] },
    { name: "Imelda", interests: ["painting", "running", "football"] },
    { name: "Josef", interests: ["shopping", "running", "cooking"] },
    { name: "Khan", interests: ["fishing", "running", "clubbing"] },
    { name: "Lionel", interests: ["gaming", "singing", "driving"] }
  ];
  
  const sharon = {
    name: "Sharon",
    interests: ["football", "painting", "gaming"]
  };
  
  function getSortedList() {
    let output = people.slice();
  
    return person;
  }
  
  function printPeople() {
    let list = getSortedList();
    list.unshift(sharon);
    list.forEach(person =&gt; {
      person.interest1 = person.interests[0];
      person.interest2 = person.interests[1];
      person.interest3 = person.interests[2];
      delete person.interests;
    });
    console.log("Friend Matching Script Output:");
    console.table(list);
    console.table(getSortedList());
  }
  
  printPeople();
  </code></pre>