2 ms·
LinkedList.prototype.reverse = function () { var tail = function(prev, current){ if (current.next) { tail(current, current.next); } else
by sturob 14y ago
LinkedList.prototype.reverse = function () {
var tail = function(prev, current){
if (current.next) {
tail(current, current.next);
} else {
this.head = current;
}
current.next = prev;
}.bind(this);
tail(null, this.head);
};