Javascript 99% Single loop clean code
dummy head to keep the \'prev\' for the real head.\n2. counting in the single loop to avoid the second loop many other solutions used.\n\n\nvar removeNthFromEnd
1. dummy head to keep the \'prev\' for the real head.\n2. counting in the single loop to avoid the second loop many other solutions used.\n\n```\nvar removeNthFromEnd = function(head, n) { \n    let dummy = new ListNode(0, head);\n    let prev = dummy;\n    let node = head;\n    let count = 1;\n    while (node.next) {\n        if (count === n) {\n            prev = prev.next;\n        } else {\n            count++;\n        }\n        node = node.next;\n    }\n    prev.next = prev.next.next;\n    return dummy.next;\n};\n```
['JavaScript']