File tree 2 files changed +13
-10
lines changed
2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ const list = () => {
5
5
return {
6
6
push ( data ) {
7
7
element = {
8
- prev : element , data,
8
+ prev : element ,
9
+ data,
9
10
} ;
10
11
return element ;
11
12
} ,
@@ -16,17 +17,19 @@ const list = () => {
16
17
current : element ,
17
18
next ( ) {
18
19
const element = this . current ;
19
- if ( ! element ) return {
20
- done : true ,
21
- value : null
22
- } ;
20
+ if ( ! element ) {
21
+ return {
22
+ done : true ,
23
+ value : null ,
24
+ } ;
25
+ }
23
26
this . current = element . prev ;
24
27
return {
25
28
done : false ,
26
- value : element . data
29
+ value : element . data ,
27
30
} ;
28
- }
29
- } )
31
+ } ,
32
+ } ) ,
30
33
} ;
31
34
} ;
32
35
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ function LinkedList() {
6
6
this . length = 0 ;
7
7
}
8
8
9
- LinkedList . prototype . push = function ( data ) {
9
+ LinkedList . prototype . push = function ( data ) {
10
10
const node = new Node ( this , data ) ;
11
11
node . prev = this . last ;
12
12
if ( this . length === 0 ) this . first = node ;
@@ -16,7 +16,7 @@ LinkedList.prototype.push = function(data) {
16
16
return node ;
17
17
} ;
18
18
19
- LinkedList . prototype . pop = function ( ) {
19
+ LinkedList . prototype . pop = function ( ) {
20
20
if ( this . length === 0 ) return null ;
21
21
const node = this . last ;
22
22
this . last = node . prev ;
You can’t perform that action at this time.
0 commit comments