I am new to javascript, I don't quite understand this.element = element; this.priority = priority; this means, is this means we have a element object. and this is point to the this element object, and this.element means element.elment? also what is this.enqueue = function(element, priority) this.enqueue means here? can someone gives me a heads up?
function PriorityQueue() {
  var items = [];
  function QueueElement(element, priority) {
    this.element = element;
    this.priority = priority;
  }
  this.enqueue = function(element, priority) {
    var queueElement = new QueueElement(element, priority);
    if (this.isEmpty()) {
      items.push(queueElement);
    } else {
      var added = false;
      for (var i = 0; i < items.length; i++) {
        if (queueElement.priority < items[i].priority) {
          items.splice(i, 0, queueElement);
          added = true;
          break;
        }
      }
      if (!added) {
        items.push(queueElement);
      }
    }
  }; 
     
     
     
     
    