@@ -20,7 +20,7 @@ let DoublyLinkedList2 = (function () {
20
20
tail . set ( this , null ) ;
21
21
}
22
22
23
- append = function ( element ) {
23
+ append ( element ) {
24
24
25
25
let node = new Node ( element ) ,
26
26
current , _tail ;
@@ -42,7 +42,7 @@ let DoublyLinkedList2 = (function () {
42
42
length . set ( this , l ) ;
43
43
}
44
44
45
- insert = function ( position , element ) {
45
+ insert ( position , element ) {
46
46
47
47
//check for out-of-bounds values
48
48
if ( position >= 0 && position <= this . size ( ) ) {
@@ -94,7 +94,7 @@ let DoublyLinkedList2 = (function () {
94
94
}
95
95
}
96
96
97
- removeAt = function ( position ) {
97
+ removeAt ( position ) {
98
98
99
99
//check for out-of-bounds values
100
100
if ( position > - 1 && position < this . size ( ) ) {
@@ -151,13 +151,13 @@ let DoublyLinkedList2 = (function () {
151
151
}
152
152
}
153
153
154
- remove = function ( element ) {
154
+ remove ( element ) {
155
155
156
156
let index = this . indexOf ( element ) ;
157
157
return this . removeAt ( index ) ;
158
158
}
159
159
160
- indexOf = function ( element ) {
160
+ indexOf ( element ) {
161
161
162
162
let current = this . getHead ( ) ,
163
163
index = - 1 ;
@@ -196,7 +196,7 @@ let DoublyLinkedList2 = (function () {
196
196
return length . get ( this ) ;
197
197
}
198
198
199
- toString = function ( ) {
199
+ toString ( ) {
200
200
201
201
let current = this . getHead ( ) ,
202
202
s = current ? current . element : '' ;
@@ -209,7 +209,7 @@ let DoublyLinkedList2 = (function () {
209
209
return s ;
210
210
}
211
211
212
- inverseToString = function ( ) {
212
+ inverseToString ( ) {
213
213
214
214
let current = this . getTail ( ) ,
215
215
s = current ? current . element : '' ;
@@ -222,19 +222,19 @@ let DoublyLinkedList2 = (function () {
222
222
return s ;
223
223
}
224
224
225
- print = function ( ) {
225
+ print ( ) {
226
226
console . log ( this . toString ( ) ) ;
227
227
}
228
228
229
- printInverse = function ( ) {
229
+ printInverse ( ) {
230
230
console . log ( this . inverseToString ( ) ) ;
231
231
}
232
232
233
233
getHead ( ) {
234
234
return head . get ( this ) ;
235
235
}
236
236
237
- getTail = function ( ) {
237
+ getTail ( ) {
238
238
return tail . get ( this ) ;
239
239
}
240
240
}
0 commit comments