Skip to content

Commit 13fbc0b

Browse files
committed
Fix code style
1 parent 2b07fee commit 13fbc0b

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

JavaScript/4-single-iterable.js

+11-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const list = () => {
55
return {
66
push(data) {
77
element = {
8-
prev: element, data,
8+
prev: element,
9+
data,
910
};
1011
return element;
1112
},
@@ -16,17 +17,19 @@ const list = () => {
1617
current: element,
1718
next() {
1819
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+
}
2326
this.current = element.prev;
2427
return {
2528
done: false,
26-
value: element.data
29+
value: element.data,
2730
};
28-
}
29-
})
31+
},
32+
}),
3033
};
3134
};
3235

JavaScript/6-doubly-proto.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function LinkedList() {
66
this.length = 0;
77
}
88

9-
LinkedList.prototype.push = function(data) {
9+
LinkedList.prototype.push = function (data) {
1010
const node = new Node(this, data);
1111
node.prev = this.last;
1212
if (this.length === 0) this.first = node;
@@ -16,7 +16,7 @@ LinkedList.prototype.push = function(data) {
1616
return node;
1717
};
1818

19-
LinkedList.prototype.pop = function() {
19+
LinkedList.prototype.pop = function () {
2020
if (this.length === 0) return null;
2121
const node = this.last;
2222
this.last = node.prev;

0 commit comments

Comments
 (0)