JSFiddle - React, Tailwind, and code Playground

JavaScript

var articles = [
     {
          id: 7989546,
          tags: [
              "107#6",
              "558234#7"
          ]
     },
     {
          id: 756,
          tags: [
              "98#6",
              "558234#7"
          ]
     },
     {
          id: 79876,
          tags: [
              "98#6",
              "107#6",
              "558234#7"
          ]
     },
     {
          id: 7984576,
          tags: [
              "98#6",
              "107#6",
              "46#6"
          ]
     }
];
var suggestions = [
     "46#6",
     "107#6",
     "48793#7"
];
var compareFn = function(left,right){
    return tagCount(right.tags) - tagCount(left.tags);
};
var tagCount = function(tags){    
    var count = 0;
    for(var i = 0; i < tags.length; i++){
     var weight = suggestions.indexOf(tags[i]);
     if(weight > -1) 
         count += tags.length - weight;
    }
    return count;
}
var a = articles.sort(compareFn);
console.log(a);