Skip to content

Commit 5a9f832

Browse files
committed
Remove node class
1 parent 3778b5b commit 5a9f832

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

JavaScript/1-simple.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
'use strict';
22

3-
class Node {
4-
constructor(list, data) {
5-
this.list = list;
6-
this.data = data;
7-
this.prev = null;
8-
this.next = null;
9-
}
10-
}
11-
123
class List {
134
constructor() {
145
this.first = null;
@@ -17,7 +8,7 @@ class List {
178
}
189

1910
push(data) {
20-
const node = new Node(this, data);
11+
const node = { list: this, data, prev: null, next: null };
2112
node.prev = this.last;
2213
if (this.length === 0) this.first = node;
2314
else this.last.next = node;

0 commit comments

Comments
 (0)