/*//Linked List data structure in Javascript
//v 1.0*/

function LinkedListNode(value){
    this.value = value;
    this.next = null;
}

//Append node to end of list, function takes the list and node to be appended as arguments
function push(list,x){
    if(list != null){
        var temp = list;
        while(temp.next != null){
            temp = temp.next;
        }
        temp.next = x;
    }
}

//Remove node at end of list
function pop(list){
    var temp = list;
    while(temp.next.next != null){
        temp = temp.next;
    }
    delete temp.next;
    temp.next = null;
}

function printList(list){
    var temp = list;
    while(temp != null){
        print(temp.value);
        temp = temp.next;
    }
}

function main(){
    //Define nodes
    // var head = new LinkedListNode("Hello");
    // var two = new LinkedListNode("How");
    // var three = new LinkedListNode("are you?");
    
    //Append nodes to head
    // push(head,two);
    // push(head,three);
    
    // printList(head);
    
    // pop(head);
}

main();
@@ -577,24 +577,900 @@
  = null;%0A%7D%0A%0A
+//count number of nodes in list%0Afunction count(list)%7B%0A    var count = 0;%0A    var temp = list;%0A    while(temp != null)%7B%0A        temp = temp.next;%0A        count++;%0A    %7D%0A    return count;%0A%7D%0A%0A//Insert node at index, function takes the list, the node to be placed, and index as arguments. Function returns the list%0Afunction insertAtIndex(list,x,index)%7B%0A    if(list == null)%7B%0A        list = x;%0A        return list;%0A    %7D%0A    %0A    if(index == 0)%7B%0A        var newList = x;%0A        x.next = list;%0A        return newList;%0A    %7D%0A    %0A    if(index %3E count(list) %7C%7C index %3C 0)%7B%0A        print(%22Error: Indexed out of bounds%22);%0A        return list;%0A    %7D%0A    %0A    var temp = list;%0A    var counts = 1;%0A    %0A    while(temp != null && (counts %3C index))%7B%0A        temp = temp.next;%0A        counts++;%0A    %7D%0A    var pointer = temp.next;%0A    temp.next = x;%0A    x.next = pointer;%0A    return list;%0A%7D%0A%0A
 function pri
@@ -1894,18 +1894,207 @@
  // 
-pop(head);
+Remove last node%0A    // pop(head);%0A    %0A    // var four = new LinkedListNode(%22Me first!%22);%0A    %0A    // Insert node at index%0A    // head = insertAtIndex(head,four,0);%0A    %0A    // printList(head);%0A    
 %0A%7D%0A%0A

Add count and insertAtIndex