Retroactive/lib/data_structures/double_linked_list.js
function (data){
    
        //create a new item object, place data in
        var node = { 
                data: data, 
                next: null,
                prev: null
            };
    
        //special case: no items in the list yet
        if (this._length == 0) {
            this._head = node;
            this._tail = node;
        } else {
        
            //attach to the tail node
            this._tail.next = node;
            node.prev = this._tail;
            this._tail = node;
        }        
        
        //don't forget to update the count
        this._length++;
    
    }
function (data){
    
        //create a new item object, place data in
        var node = { 
                data: data, 
                next: null,
                prev: null
            };
    
        //special case: no items in the list yet
        if (this._length == 0) {
            this._head = node;
            this._tail = node;
        } else {
        
            //attach to the tail node
            this._tail.next = node;
            node.prev = this._tail;
            this._tail = node;
        }        
        
        //don't forget to update the count
        this._length++;
    
    }
function ( data ) { //create a new item object, place data in var node = { data : data , next : null , prev : null } ; //special case: no items in the list yet if ( this . _length == 0 ) { this . _head = node ; this . _tail = node ; } else { //attach to the tail node this . _tail . next = node ; node . prev = this . _tail ; this . _tail = node ; } //don't forget to update the count this . _length ++ ; }
Appends some data to the end of the list. This method traverses
the existing list and places the value at the end in a new item.
@param {variant} data The data to add to the list.
@return {Void}
@method add
Appends some data to the end of the list . This method traverses the existing list and places the value at the end in a new item .