@@ -25,7 +25,6 @@ function updateBalance() {
2525 const balance = transactions . reduce ( ( acc , transaction ) => {
2626 return transaction . type === "income" ? acc + transaction . amount : acc - transaction . amount ;
2727 } , 0 ) ;
28- < << << << HEAD
2928
3029 totalIncome = transactions . reduce ( ( acc , transaction ) => {
3130 return transaction . type === "income" ? acc + transaction . amount : acc ;
@@ -35,17 +34,6 @@ function updateBalance() {
3534 return transaction . type === "expense" ? acc + transaction . amount : acc ;
3635 } , 0 ) ;
3736
38- = === ===
39-
40- totalIncome = transactions . reduce ( ( acc , transaction ) => {
41- return transaction . type === "income" ? acc + transaction . amount : acc ;
42- } , 0 ) ;
43-
44- totalExpense = transactions . reduce ( ( acc , transaction ) => {
45- return transaction . type === "expense" ? acc + transaction . amount : acc ;
46- } , 0 ) ;
47-
48- > >>> >>> a548c639afa0f1ac1cdb441c63180145b7acef31
4937 balanceAmount . textContent = balance . toFixed ( 2 ) ;
5038 incomeAmount . textContent = totalIncome . toFixed ( 2 ) ;
5139 expenseAmount . textContent = totalExpense . toFixed ( 2 ) ;
@@ -65,13 +53,8 @@ function addTransaction(event) {
6553 amount,
6654 type
6755 } ;
68- < << << << HEAD
6956
7057
71- = === ===
72-
73-
74- >>> >>> > a548c639afa0f1ac1cdb441c63180145b7acef31
7558 transactions . push ( transaction ) ;
7659 if ( type === "income" ) {
7760 totalIncome += amount ;
@@ -101,11 +84,6 @@ function deleteTransaction(index) {
10184 updateTransactions ( ) ;
10285 updateBalance ( ) ;
10386 saveTransactions ( ) ;
104- < << << << HEAD
105-
106- = === ===
107-
108- >>> >>> > a548c639afa0f1ac1cdb441c63180145b7acef31
10987}
11088
11189// Function to save transactions to Local Storage
@@ -159,33 +137,18 @@ function editTransaction(index) {
159137 amount : updatedAmount ,
160138 type : updatedType
161139 } ;
162- << < << << HEAD
163-
164- === = ===
165-
166- >>> > >>> a548c639afa0f1ac1cdb441c63180145b7acef31
167140 if ( transaction . type === "income" ) {
168141 totalIncome -= transaction . amount ;
169142 totalIncome += updatedAmount ;
170143 } else if ( transaction . type === "expense" ) {
171144 totalExpense -= transaction . amount ;
172145 totalExpense += updatedAmount ;
173146 }
174- < << << << HEAD
175-
176- = === ===
177-
178- >>> >>> > a548c639afa0f1ac1cdb441c63180145b7acef31
179147 transactions [ index ] = updatedTransaction ;
180148 alert ( `Transaction "${ updatedTransaction . description } " updated successfully!` ) ;
181149 updateTransactions ( ) ;
182150 updateBalance ( ) ;
183151 saveTransactions ( ) ;
184- < << << << HEAD
185-
186- = === ===
187-
188- >>> >>> > a548c639afa0f1ac1cdb441c63180145b7acef31
189152 } else {
190153 alert ( "Invalid input! Please try again." ) ;
191154 }
0 commit comments