JavaScript Implementation of the Binary Heap