code: function () {
      // main code
      var x = new StablePriorityQueue(function (a, b) {
          return a.name < b.name ? -1 : (a.name > b.name ? 1 : 0) ;
      });
      x.add({name:"Jack", age:31});
      x.add({name:"Anna", age:111});
      x.add({name:"Jack", age:46});
      x.add({name:"Jack", age:11});
      x.add({name:"Abba", age:31});
      x.add({name:"Abba", age:30});
      while (!x.isEmpty()) {
          console.log(x.poll());
      }
      x = new StablePriorityQueue(function(a, b) {
            return a.energy - b.energy;
      });
      [{ name: 'player', energy: 10},
       { name: 'monster1', energy: 10},
       { name: 'monster2', energy: 10},
       { name: 'monster3', energy: 10}
      ].forEach(function(o){
            x.add(o);
      })
      while (!x.isEmpty()) {
          console.log(x.poll());
      }
  
  }
docs: just for illustration purposes