function ListNode(val, next) { this.val = (val === undefined ? 0 : val) this.next = (next === undefined ? 0 : next) } var TEST = function () { function _getNum(node) { let str = ''; while (node !== 0) { str += node.val; node = node.next; } return parseInt(str) || 0; } function _getNode(str) { let node = 0; for (var i=str.length-1; i>=0; --i) { node = new ListNode(str[i], node); } return node; } return { exec: function (l1, l2) { return _getNode(_getNum(l1) + _getNum(l2) + ''); } }; }();