Reverse Linked List 2

Reverse a linked list from position m to n. Do it in-place and in one-pass.

For example:
Given 1->2->3->4->5->NULL, m = 2 and n = 4,

return 1->4->3->2->5->NULL.

Note:
Given m, n satisfy the following condition:
1 ≤ m ≤ n ≤ length of list.

/**
 * Definition for singly-linked list.
 * function ListNode(val) {
 *     this.val = val;
 *     this.next = null;
 * }
 */

/**
 * @param {ListNode} head
 * @param {number} m
 * @param {number} n
 * @return {ListNode}
 */



@@ -487,8 +487,287 @@
 %7D%0A */%0A%0A%0A
+var reverseBetween = function(head, m, n) %7B%0A    let current = head;%0A    const dup = %5Bhead.val%5D;%0A    while (current.next) %7B%0A        current = current.next;%0A        dup.push(current.val);%0A    %7D%0A    return dup.slice(0, m - 1).concat(dup.slice(m - 1, n).reverse(), dup.slice(n));%0A%7D;%0A

add first attemt