budget.js
// removes the income whose button was clicked from the Incomes column

removes the income whose button was clicked from the Incomes column
removes the income whose button was clicked from the Incomes column
function removeItemIncome(id) {
           let aux_name = [];
           let aux_sum = [];
           aux_name = name_incomes.map((x) => x);
           aux_sum = sum_incomes.map((x) => x);
           name_incomes = [];
           sum_incomes = [];
           index_income = 1;
           let removeTable = document.getElementById('incomeTable');
           let parentElement = removeTable.parentElement;
           parentElement.removeChild(removeTable);
           document.getElementById("income").innerHTML = `
                   <h2 class="smallTitle">Incomes</h2>
                   <table id="incomeTable">
                       <td>Name</td>
                       <td>Sum</td>
                   </table>
           `
           for (let i = 0; i<aux_name.length; i++)
               if(i != id - 1) {
                   name_incomes.push(aux_name[i]);
                   sum_incomes.push(aux_sum[i]);
                   addIncomeToTable();
               }
               calculateBudget();
       }
function removeItemIncome ( id ) { let aux_name = [ ] ; let aux_sum = [ ] ; aux_name = name_incomes . map ( ( x ) => x ) ; aux_sum = sum_incomes . map ( ( x ) => x ) ; name_incomes = [ ] ; sum_incomes = [ ] ; index_income = 1 ; let removeTable = document . getElementById ( 'incomeTable' ) ; let parentElement = removeTable . parentElement ; parentElement . removeChild ( removeTable ) ; document . getElementById ( "income" ) . innerHTML = ` ` for ( let i = 0 ; i < aux_name . length ; i ++ ) if ( i != id - 1 ) { name_incomes . push ( aux_name [ i ] ) ; sum_incomes . push ( aux_sum [ i ] ) ; addIncomeToTable ( ) ; } calculateBudget ( ) ; }
removes the income whose button was clicked from the Incomes column
removes the income whose button was clicked from the Incomes column