Skip to content

Commit 8646a22

Browse files
committed
code refactoring
1 parent a4526c0 commit 8646a22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

chapter04/03-PriorityQueue.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ function PriorityQueue() {
33
var items = [];
44

55
function QueueElement (element, priority){
6-
element = element;
7-
priority = priority;
6+
this.element = element;
7+
this.priority = priority;
88
}
99

1010
this.enqueue = function(element, priority){
1111
var queueElement = new QueueElement(element, priority);
1212

13-
if (isEmpty()){
13+
if (this.isEmpty()){
1414
items.push(queueElement);
1515
} else {
1616
var added = false;

0 commit comments

Comments
 (0)