/**
* Definition for singly-linked list.
* function ListNode(val, next) {
* this.val = (val===undefined ? 0 : val)
* this.next = (next===undefined ? null : next)
* }
*/
/**
* @param {ListNode} head
* @return {ListNode}
*/
var deleteDuplicates = function(head) {
let result = head
while(result) {
if(result.next !== null && result.val === result.next.val) {
result.next = result.next.next
continue
}
result = result.next
}
return head;
};