So now we're recreating the function that is going to differentiate between our income as well as expenses.
So for that purpose, let us create a contact amount that is going to be used by both our income as
well as our expenses.
So let's just create a cost amount and this is going to be let's just transactions dirt map and it is
going to take a single transaction and a return of transactions that amount.
Not amount.
Because the amount of money that we're having in each entry, right?
So we are having the transactions and we are mapping them one by one.
Now let's create the two cards which were in our expense sheet, the income and the expense one.
So let's just create a constant.
And this is going to be an income.
Now this income is going to take that amount.
Now they're going to be three functions that we are using of the JavaScript.
One is going to be the filter and the filter will be using the reduced function.
To add up all what is in there.
And electoral dysfunction will be using two fixed.
You know, as you might already know, we are using filters to reduce the amount to filter out all the
positive values, the only one, the positive areas to be in here and to reduce to add up all the values
and low fixed so that our values decimal point, there's not more than two.
So two fixed always need to have only two numbers at the end after the decimal point.
And this is going to be same for both income as well as expenses copied and pasted.
This is going to be a.
Expense.
Now inside of her, and we're just filtering out all positive numbers.
So this is going to take up an item and we will ensure that the item is always greater than greater
than zero.
And if the item is greater than zero, then we want to reduce that particular element and instead reduce
function well, right?
We'll take two parameters around as well as item amount item, and we'll be adding.
The amount.
And it is going to be fixed to do numbers now if you just hit safe.
And apart from this, we will also be having a zero.
It safe, OK, so we have configured our income.
Known, say, the expense column we are going to use the same what we used in our filter of income,
but this time the items is supposed to be less than zero.
So this time we would be using less than zero.
And inside the reduced function will be adding up.
So it is going to be the same as this.
And even this time, we want it to be fixed to zero, so we have used the expense column as well, and
our income know it's time to use them inside our application dynamically.
So head back to your typography where you have added plus income and selected and now will just put
up income dynamically.
And in the expense, be having expense.
So we is fully clear to that function.
And now what remains is the mixed, so we'll be configuring it next.