From c3395be905b25c8ebd9fb1b15080f849e36c8929 Mon Sep 17 00:00:00 2001 From: JoseHung <1309716944@qq.com> Date: Thu, 22 Dec 2022 18:53:38 +0800 Subject: [PATCH] fix the error about assignment to constant --- codes/javascript/include/ListNode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codes/javascript/include/ListNode.js b/codes/javascript/include/ListNode.js index 72306548..6e226e9c 100755 --- a/codes/javascript/include/ListNode.js +++ b/codes/javascript/include/ListNode.js @@ -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;