WEBVTT 0 00:00.600 --> 00:06.450 All right, so this was a relatively simple exercise, but I'm going to quickly go through the solution 1 00:06.660 --> 00:09.540 in case you got stuck and you wanted to see how it's done. 2 00:10.230 --> 00:12.390 So the goal is very simple. 3 00:12.390 --> 00:19.410 We want to be able to output this exact sentence, replacing the x, y and z with the actual number 4 00:19.410 --> 00:23.400 of days, weeks and months we have left if we live until 90. 5 00:24.030 --> 00:30.450 So in this case, our age is going to be passed in as an input to this function lifeInWeeks, and 6 00:30.450 --> 00:33.550 we're going to be able to use it to do all of these calculations. 7 00:34.170 --> 00:41.340 So here it tells us that we're assuming there's 365 days in a year, 52 weeks in a year and 12 months 8 00:41.340 --> 00:41.780 in a year. 9 00:42.090 --> 00:46.630 So we can use this information to calculate the days, weeks and months remaining. 10 00:47.160 --> 00:48.610 So let's go ahead and do that. 11 00:48.990 --> 00:51.810 We're saying that we're assuming that we'll live until 90. 12 00:52.170 --> 00:58.300 So let's create a variable called yearsRemaining that's going to be set to 90 - age. 13 00:58.890 --> 01:04.230 Now, once we've got the years remaining, then we can work out the number of days, weeks, and month 14 01:04.230 --> 01:04.590 left. 15 01:04.890 --> 01:12.000 So days = yearsRemaining * 365. 16 01:13.060 --> 01:15.640 weeks = yearsRemaining 17 01:16.790 --> 01:27.020 multiplied by 52. And finally months = yearsRemaining * 12. 18 01:27.770 --> 01:32.990 So now that we've got all of our numbers, days, weeks and months and make sure that we haven't made 19 01:32.990 --> 01:37.820 any typos anywhere, then we're ready to go ahead and console-log the output. 20 01:38.930 --> 01:44.360 So I'm going to go ahead and type out this message, trying to make sure that I don't make any typos 21 01:44.360 --> 01:46.160 and have the same capitalization. 22 01:46.610 --> 01:53.730 So you have x days, y weeks and z months left. 23 01:54.170 --> 01:54.840 Full stop. 24 01:55.460 --> 02:02.270 So this is what I'm going to try and output and I'm going to replace each of these with the actual calculated 25 02:02.270 --> 02:02.920 values. 26 02:02.930 --> 02:09.590 So I'm going to delete the x, add some double quotes and then use some plus signs so that I can actually 27 02:09.590 --> 02:15.290 concatenate the actual value of days. And then I'm just going to do this for the other parts. 28 02:18.240 --> 02:24.000 So now that I think I've completed my code, I'm going to click on this link to go to my Repl.it playground 29 02:24.120 --> 02:27.450 and I'm going to paste my code inside this function. 30 02:27.720 --> 02:34.500 So now we can go ahead and call this function lifeInWeeks and pass in our actual age. 31 02:34.500 --> 02:40.740 Let's say I am 12 and then we can click on Run to see if it actually works. 32 02:41.190 --> 02:46.980 So if I was 12 years old, 90 - 12 is going to be equal to 78. 33 02:47.250 --> 02:55.980 So the days remaining will be 78 multiplied by 365, which is twenty-eight thousand four hundred and 34 02:55.980 --> 02:56.760 seventy. 35 02:57.270 --> 03:04.160 The weeks remaining will be 78 multiplied by 52, which is 4,056. 36 03:04.650 --> 03:12.690 And finally, the month remaining will be 78 multiplied by twelve, and that's 936 37 03:12.690 --> 03:13.480 months. 38 03:13.980 --> 03:20.370 So now that I've assured myself that my functions are working, I can go back and go ahead and click 39 03:20.370 --> 03:21.630 on check solution. 40 03:22.320 --> 03:30.450 And hopefully as long as my sentence matches the exact example output including all the spaces and 41 03:30.450 --> 03:37.410 the capitalizations and all of the commas and full stops, then my solution should pass and I should 42 03:37.410 --> 03:38.830 have completed this challenge. 43 03:38.880 --> 03:41.230 So how did you get on? If you got stuck 44 03:41.250 --> 03:44.280 go back to it and try to fix it so that it works.