by sturob · 13y ago · 0 comments
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);
};No comments yet.