Skip to content

Commit cd6a0e7

Browse files
committed
little refactor
1 parent 5c691ba commit cd6a0e7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/_.general/linkedList.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,9 @@ export const prepend = (val, lList) => {
143143
*/
144144
export const reverse = (head) => {
145145
let newHead = null;
146-
let next = null;
147146

148147
while (head) {
149-
next = head.next;
148+
const { next } = head;
150149
head.next = newHead;
151150
newHead = head;
152151
head = next;

0 commit comments

Comments
 (0)