fix the error about assignment to constant

This commit is contained in:
JoseHung 2022-12-22 18:53:38 +08:00
parent bb20cb9db2
commit c3395be905

View file

@ -22,7 +22,7 @@ class ListNode {
*/
arrToLinkedList(arr) {
const dum = new ListNode(0);
const head = dum;
let head = dum;
for (const val of arr) {
head.next = new ListNode(val);
head = head.next;