News for hackers. Stuff that matters.
Re:JavaScript developer, can you reverse a linked list? by hqm42 on Thursday February 21, 2013 @12:07PM (#5258549)

  LinkedList.prototype.reverse = function () {
    var rev = function(e,tail) {
      if (!e) {
        return tail;
      } else {
        var next = e.next;
        e.next = tail;
        return rev(next, e);
      }
    };
    this.head = rev(this.head, null);
  };

There are no comments on this comment yet.