Recently I had an opportunity of solving one of more famous algorithmic problems using JavaScript. One of the approaches to this problem is to use Priority Queue data structure to keep track of most frequent items. Unfortunately, JavaScript doesn't have standard implementation for such data structure. So - let's build one.