Implementation of a Stack without Array - Push and Pop

Stack implementation

by Ryan Brown

HTML

<form id="formski">

<input type = "button" value = "Create Randomized String List" onClick="createRandom();" />
<br>
<input type = "button" value = "Sort String List into Numerical Order" onClick="numericalSort();" />

<p>
Use the textbox below to enter a value, to sort this value into the existing list, click the button labeled " Insert and Sort"
</p>
<br>
<input type = "textbox" id= "userInsert" value = "20" />
<input type = "button" value = "Insert and Sort" onClick="SortInsert();" />

<p id='output1'></p>
<p id='output2'></p>
<p id ='inSortOutput'></p>
</form>

JavaScript

var Node = function(_content)
  	{
    	this.next = null;
    	this.last = null;
    	this.content = _content;
     }
     

  var Queue = function()
  	{
    	this.front = null;
      this.back = null;
      
      this.addToFront = function(_content)
      	{
        	if (this.front == null)
          	{
            		this.front = new Node(_content);
              	this.back = this.front;
             	return this;
            }
          
          var createdNode = new Node(_content);
          	createdNode.next = this.front;
          	this.front.previous = createdNode;
          	this.front = createdNode;
          return this;
        }
      this.addToBack = function(_content)
      	{
        	if (this.front == null)
          	{
            		this.front = new Node(_content);
            		this.back = this.front;
           		return this;
            }
        		var createdNode = new Node(_content);
          	createdNode.previous = this.back;
          	this.back.next = createdNode;
          	this.back = createdNode;
          return this;
        }
     
     this.insertA = function(valueToAdd)
     	{
      	var listA= "";
        var node = this.back;
        
        if(valueToAdd < this.front.content)
       		{
          	return "Front";
          }
        if(valueToAdd < this.back.content)
        	{
          	return "Back";
          }
        while (node != null)
        	{
          	if(valueToAdd > node.content)
            	{
              	var nodeToInsert = new Node(valueToAdd);
              	node.next.previous = nodeToInsert;
              	nodeToInsert.previous = node;
              	nodeToInsert.next = node.next;
              	node.next = nodeToInsert;
             return "complete";
             }
           node = node.previous;
          }
        return;
      }
      
    this.removeFront = function()
    	{
      	if(this.front == null)
        	{
          return null;
          }
        var popContent =...