(resolved) return the first node, each node has two key, val point to the value, next point to the next node

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.

You may assume the two numbers do not contain any leading zero, except the number 0 itself.

Example:

Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
Explanation: 342 + 465 = 807.

It should be return a linked list

but this solution return { val, next: add(l1 && l1.next, l2 && l2.next, newCarry) }

var addTwoNumbers = function(l1, l2) {
  return add(l1, l2, 0)

  function add(l1, l2, carry) {
    const v1 = (l1 && l1.val) || 0
    const v2 = (l2 && l2.val) || 0
    const sum = v1 + v2 + carry
    const newCarry = Math.floor(sum / 10)
    const val = sum % 10
    return l1 || l2 || carry
      ? { val, next: add(l1 && l1.next, l2 && l2.next, newCarry) }
      : null
  }
}

This solution is very easy to understand:

var addTwoNumbers = function(l1, l2) {
  let res = new ListNode(-1),
      dummy = res,
      sum = 0, carry = 0;

  while(l1 || l2 || sum > 0) {
      if(l1) {
          sum += l1.val;
          l1 = l1.next;
      }

      if(l2) {
          sum += l2.val;
          l2 = l2.next;
      }

      if(sum >= 10) {
          sum -= 10;
          carry = 1;
      }

      dummy.next = new ListNode(sum);
      dummy = dummy.next;
      sum = carry;
      carry = 0;
  }
  return res.next;
};

Isn’t this from Leetcode? The solution is explained quite well there, with a picture showing how the carry is implemented.