How to enter data into the table with sorting?

Good day!
Would like to know how to implement the following functionality.

There is a calculator that after clicking the button is formed, the number is displayed in the table.
Roughly speaking there is a table in which there are numbers from 1 to 20 and creates a new number, say 12, and it should appear in the table on 12th place and the points should line up from 1 to 21.

I don't know how it's easier to do. Can show the Word or Excel file or simply laid out to the table once to remove them.

Files do not need to save, that is, after the display of the file it is not saved, just displayed in order.

Roughly speaking. How to sort the table

If anyone can help I would be very grateful!
April 19th 20 at 12:48
1 answer
April 19th 20 at 12:50
  1. Go through the table rows and save them in an array of objects. Each object two fields: the string table and the value of the number in that row.
  2. Sort this array by field number.
  3. Delete all rows from the table.
  4. Fill in the table rows from the sorted array of objects.
Do not prompt as in the code would that be? - tomasa.Connelly4 commented on April 19th 20 at 12:53

Find more questions by tags ExcelJavaScriptjQuery