[HTML] help me please with editing array
Hi, so in my application i have created a sortable array. i want the user to be able to enter 2 values in miles and then the range of values should be added to the array and for each value the equivalent value in KM should be next to it. below is a snippet of my code but when i click the "begin conversion" button, nothing is added to the array. what am i doing wrong here? <script> var myArray = [{ 'Miles': '1', 'KM': '1.609' }, { 'Miles': '2', 'KM': '3.218' }, { 'Miles': '3', 'KM': '4.827' }, { 'Miles': '4', 'KM': '6.436' }, { 'Miles': '5', 'KM': '8.054' }, { 'Miles': '6', 'KM': '9.654' }, ] $('th').on('click', function() { var column = $(this).data('column') var order = $(this).data('order') var text = $(this).html() text = text.substring(0, text.length - 1) if (order == 'desc') { $(this).data('order', "asc") myArray = myArray.sort((a, b) => a[column] > b[column] ? 1 : -1) text += '▼' } else { $(this).data('order', "desc") myArray = myArray.sort((a, b) => a[column] < b[column] ? 1 : -1) text += '▲' } $(this).html(text) buildTable(myArray) }) buildTable(myArray) function buildTable(data) { var table = document.getElementById('myTable') table.innerHTML = '' for (var i = 0; i < data.length; i++) { var row = `<tr> <td>${data[i].Miles}</td> <td>${data[i].KM}</td> </tr>` table.innerHTML += row } } function Calculate() {