JavaScript iterative solution
\nvar deleteDuplicates = function(head) {\n    const dummy = new ListNode();\n    dummy.next = head;\n    let node = dummy;                                     
```\nvar deleteDuplicates = function(head) {\n    const dummy = new ListNode();\n    dummy.next = head;\n    let node = dummy;                                                  // the last known distinct node\n    while (node.next) {\n        if (node.next.next && node.next.val === node.next.next.val) {  // if the next two nodes are equal...\n            let nonValNode = node.next.next.next;\n            while (nonValNode && nonValNode.val === node.next.val) {   // ...find the first one that isn't...\n                nonValNode = nonValNode.next;\n            }\n            node.next = nonValNode;                                    // ...and glue it to the last known distinct node;...\n        } else {\n            node = node.next;                                          // ...otherwise the next node is distinct\n        }\n    }\n    return dummy.next;\n};\n```
['JavaScript']