1
00:00:00,180 --> 00:00:05,730
Within this lesson, we are going to be finishing off our tip calculating project, let's add in a new

2
00:00:05,730 --> 00:00:06,280
variable.

3
00:00:06,300 --> 00:00:09,960
I'm going to call it temp B, essentially our template for our output.

4
00:00:10,170 --> 00:00:16,230
I'm using single quotes within this one because in case I want to use double quotes within my HTML,

5
00:00:16,350 --> 00:00:17,670
I want to fine tune it.

6
00:00:17,670 --> 00:00:23,040
So and I'm also going to update the output to be inner HTML as well so we can write.

7
00:00:23,040 --> 00:00:30,120
You should tip and then have a dollar sign value there and then we can break out of the string.

8
00:00:30,150 --> 00:00:37,380
So this would be whatever our tip value is and then break back into the string with a single code on.

9
00:00:37,380 --> 00:00:46,170
And then this is the total number of or total cost that we're calculating that tip upon.

10
00:00:46,680 --> 00:00:47,760
So close that off.

11
00:00:47,760 --> 00:00:49,490
We need to create those variables.

12
00:00:50,640 --> 00:00:57,900
So Tip will contain a value of what we were outputting in the console and we want to update this and

13
00:00:57,900 --> 00:00:58,430
fix it.

14
00:00:58,620 --> 00:01:00,400
So we're going to use two fixed.

15
00:01:00,420 --> 00:01:07,440
And essentially what this does is at format's the number to a fixed point notation and with currency

16
00:01:07,440 --> 00:01:09,780
numbers, we want to account for sense.

17
00:01:09,940 --> 00:01:14,630
So we want to move in two decimal places over to account for the sense.

18
00:01:14,940 --> 00:01:17,400
So that's going to give us a value for the tip.

19
00:01:18,240 --> 00:01:21,780
And then we already have that value for the cost as well.

20
00:01:22,200 --> 00:01:30,210
So let's save that and refresh and let's do TYP and then we need to still update this to our HTML and

21
00:01:30,210 --> 00:01:33,920
the HTML here is going to be whatever the value of Tempest's.

22
00:01:34,260 --> 00:01:42,180
So refresh typ and we get an output of you should tip 15 dollars on object because we don't have the

23
00:01:42,180 --> 00:01:42,820
value there.

24
00:01:42,990 --> 00:01:45,150
So make sure that we add in value there.

25
00:01:45,420 --> 00:01:46,620
Try that one more time.

26
00:01:46,800 --> 00:01:50,240
You should tip 15 dollars on one type of format.

27
00:01:50,250 --> 00:01:52,800
We can calculate whatever the tip is going to be.

28
00:01:52,980 --> 00:01:58,200
So even if this has since attached to it, you're going to see that it outputs here within that sense

29
00:01:58,200 --> 00:01:59,400
format as well.

30
00:01:59,550 --> 00:02:02,880
And we get the tip being calculated on the total value.

31
00:02:02,880 --> 00:02:05,040
That's input within that input field.

32
00:02:05,040 --> 00:02:07,830
In the upcoming lesson, I'll show you how you comtemplate this.

33
00:02:07,980 --> 00:02:10,800
And this is going to make your code a little bit neater as well.

34
00:02:10,950 --> 00:02:17,310
So templating what that does is it allows you to bring the object in without having these breaks out

35
00:02:17,310 --> 00:02:18,410
of the string value.

36
00:02:18,600 --> 00:02:20,300
So that's coming up in the next lesson.

37
00:02:20,580 --> 00:02:25,860
So go ahead and try this out and make sure that your tip calculator is functioning.
