JavaScript Solution
\nvar mergeNodes = function(head) {\n    var res = new ListNode()\n    var ans = res ;\n    var current = head.next;\n    var sum = 0;\n    while(current){\n   
```\nvar mergeNodes = function(head) {\n    var res = new ListNode()\n    var ans = res ;\n    var current = head.next;\n    var sum = 0;\n    while(current){\n              \n            if(current.val != 0){\n                sum = sum + current.val;\n            }else{\n                res.next = new ListNode(sum);\n                sum = 0;\n                res = res.next;\n            }\n        current = current.next;\n            \n    }\n    return ans.next;\n};\n```
['JavaScript']