Welcome back.
How's your calculator coming?
We noticed that we've got most of the functionality that we need, it is up and working and we're still
missing some functionality on a few of the key keys.
So that one being the equals sign that it adds, that equals sign in there and as well as the C, which
is not exactly supposed to actually clear it out.
So we have to actually look for those separately.
So we see that if the my value is an equal sign that, well, all we need to do is actually do the evaluation.
We don't want to do anything outside of there.
So let's take a look and we're going to see if the my value so do a condition if my value is equal to
and that's the equal sign that we're looking for.
And then the rest we can do else here so this else stuff can get added in afterwards.
So we take our my value with the equal sign.
We're not adding anything.
All we're doing is we're doing the evaluation that's going to update the text.
So three plus three and we do equal it will move it into six so it doesn't add anything into the string.
And we don't actually want that equal sign to add anything into the string itself.
So see that that works nice and neatly and gives us the ability to utilize the equal sign.
So other thing that we need to do as well is we need to add some type of function for the C, so if
that is a C, then what we want to do is clear out that value.
So we're going to take a look and we're going to see if my value is an equal sign or if it's equal to
a C, or we can have another separate condition for that as well.
So checking to see if it's equal to that.
And over here, let's do a quick check to see if my value is equal to C, and if it is, then we know
that this is what this is a function that we need to run here.
And the C is to clear the miscalculation calculation.
So taking the miscalculation, we don't want to do any evaluation or anything like that.
We're taking the my calculation and we're setting my calculation to a value of zero.
So it's a.
And we could actually do this near the end, so it doesn't interfere with any of our calculations.
So even if we've got a bunch of other values there, we're adding it in by default.
If we had clear always, it brings it back down to zero.
So we go we've got our fully functional calculator all built with JavaScript and as dynamically as possible,
all the calculations works and you can try it for yourself.
So go ahead and add in these last two conditions to fix the calculator functionality.
And coming up next, we'll do a quick code review of all of the functions and all of the code that we've
run through and built out to build this calculator.
So that's all coming up next.