WEBVTT 0 00:00.690 --> 00:07.410 All right guys, in the next lesson, I've got a coding exercise for you, and it's meant to test 1 00:07.410 --> 00:09.730 your understanding of JavaScript variables. 2 00:10.200 --> 00:15.450 Now, when you head over to the next lesson, you'll find a section with the instructions at the top 3 00:15.660 --> 00:17.490 and your code file at the bottom. 4 00:17.940 --> 00:24.720 Now, the goal is to switch the values that are held in two variables around. 5 00:25.200 --> 00:31.890 So to begin, we have a variable a which holds the value 3 and the variable b which holds the 6 00:31.890 --> 00:32.830 value 8. 7 00:33.450 --> 00:40.350 Now you have to write some code on lines 7, 8 and 9 so that the values are switched around, 8 00:40.350 --> 00:44.730 so that a holds 8 instead and b holds 3. 9 00:45.670 --> 00:51.190 The way I like to think about it is let's say you had two buckets, right? Bucket a and bucket b. A 10 00:51.190 --> 00:53.420 holds some sand and B holds some water. 11 00:53.890 --> 00:58.210 How would you get the contents of these two buckets to switch around? 12 00:58.480 --> 01:00.600 That's basically your goal for this challenge. 13 01:01.240 --> 01:05.380 But there's a couple of rules that you have to follow in order to get the correct answer. 14 01:05.950 --> 01:09.600 Now, first, you should not change any of the existing code. 15 01:09.850 --> 01:12.750 So don't touch this part and don't touch this part. 16 01:13.360 --> 01:16.660 You are just allowed to write in these three lines. 17 01:17.530 --> 01:21.220 Now, the second rule is you're not allowed to type any numbers. 18 01:21.230 --> 01:26.890 You can't just simply say, well, a = 8 and b = 3. 19 01:27.430 --> 01:29.680 This is not a valid solution. 20 01:30.520 --> 01:34.810 Now, the final rule is you're not allowed to redeclare the variables either. 21 01:35.080 --> 01:42.220 So you can't, for example, just say, well, now a= "8" and b = "3". 22 01:42.250 --> 01:44.090 This is also wrong. 23 01:44.620 --> 01:50.350 So have a think about how you can solve this challenge given all of these constraints. 24 01:50.800 --> 01:54.610 And over here, I've got a code playground's set up for you. 25 01:55.120 --> 02:00.310 So when you click on it, you should be taken to the same file where you can write your code and you 26 02:00.310 --> 02:02.690 can use this playground to test out your code. 27 02:03.130 --> 02:08.980 So, for example, at the moment, if I just click run, then it's going to log that a is 3 and 28 02:08.980 --> 02:10.060 b is 8. 29 02:10.690 --> 02:15.540 Now, what we want to happen is when we hit run, it should say the opposite. 30 02:15.550 --> 02:17.440 a is 8 and b is 3. 31 02:17.710 --> 02:24.070 So have a play around with the code and use the Repl.it to test out your code and your hypotheses and 32 02:24.070 --> 02:27.190 hit run to see if it actually does what you expect it to. 33 02:27.610 --> 02:32.500 And then once you think you've got the solution, then go ahead and write them in your code file here 34 02:32.800 --> 02:38.170 and you can click on Check Solution to see if you got the answer right. Now 35 02:38.170 --> 02:43.000 once you're done, you can click, continue and I'll talk you through the solution code. 36 02:43.420 --> 02:46.960 So head over to the next lesson and start the code challenge.