My code generates a two dimensional matrix when the OK is clicked. The code stores the data in the multidimensional array, but I am trying to add a sort function to the code which rearranges the code in ascending order using the 4th text box. Any suggestions on how I can do that ?
HTML Code
<div class="rightDiv">
<div id = "pastcalcblock"> 
    <h3> PAST CALCULATIONS </h3>
         <input type = "text" size = "1" id = "text1"/>
         <input type = "text" size = "1" id = "text2"/>
         <input type = "text" size = "1" id = "text3"/>
         <input type = "text" size = "1" id = "text4"/><br>
         <input type = "button" value = "Ok" id = "operation" onClick = "display()"/>
         <div id = "resultTab">
                SORT<br>
                    <input type = "button" value = "As Entered" id = "enteredBut">
                    <input type = "button" value = "By Result" id = "resultBut" onClick = "sort()"><br><br>
                    <div id="expressions">
                    </div>                
            </div>
        </div>
Javascript Code
    function display()
    {
    var arrayOne =[document.getElementById('text1').value,document.getElementById('text2').value,document.getElementById('text3').value,document.getElementById('text4').value ];
      new_array=arrayOne.join(" ");
    var para = document.createElement("p");
    var t = document.createTextNode(new_array);
    para.appendChild(t)
    document.getElementById("expressions").appendChild(para);
    }
 function sort(){
            var dispArr = [document.getElementById('text1').value, 
document.getElementById('text2').value, document.getElementById('text3').value,document.getElementById('text4').value];
            var myArray = [];
             for(var i = 0 ; i < 1 ; i ++ ) {
                 myArray[i] = [];
                 for(var j = 0 ; j < 5 ; j++ )
                 {
                     myArray[i][j] = dispArr[j];
                     console.log(myArray[i][j]);
                  } 
             }
        }
