Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,730 --> 00:00:08,250
All right guys in the next lesson I've got a coding exercise for you and it's meant to test your understanding
2
00:00:08,370 --> 00:00:10,170
of JavaScript variables.
3
00:00:10,200 --> 00:00:15,870
Now when you head over to the next lesson you'll find a section with the instructions at the top and
4
00:00:15,870 --> 00:00:18,000
your code file at the bottom.
5
00:00:18,000 --> 00:00:26,280
Now the goal is to switch the values that are held in two variables around so to begin.
6
00:00:26,280 --> 00:00:33,510
We have a variable a which holds the value three and the variable B which holds the value eight.
7
00:00:33,510 --> 00:00:40,350
Now you have to write some code on lines seven eight and nine so that the values are switched around
8
00:00:40,350 --> 00:00:47,950
so that a holds eight instead and b holds three The way I like to think about it is let's say you had
9
00:00:47,950 --> 00:00:53,880
two buckets right bucket and Bucket B a hold some sand and b hold some water.
10
00:00:53,920 --> 00:00:58,480
How would you get the contents of these two buckets to switch around.
11
00:00:58,480 --> 00:01:00,960
That's basically your goal for this challenge.
12
00:01:01,240 --> 00:01:05,830
But there's a couple of rules that you have to follow in order to get the correct answer.
13
00:01:05,980 --> 00:01:12,430
Now first you should not change any of the existing code so don't touch this part and don't touch this
14
00:01:12,430 --> 00:01:13,130
pope.
15
00:01:13,420 --> 00:01:17,580
You are just allowed to write in these three lines.
16
00:01:17,590 --> 00:01:21,280
Now the second rule is you're not allowed to type any numbers.
17
00:01:21,280 --> 00:01:27,430
You can't just simply say well a equals eight and b equals three.
18
00:01:27,430 --> 00:01:30,540
This is not a valid solution.
19
00:01:30,550 --> 00:01:36,370
Now the final rule is you're not allowed to read declare the variables either so you can't for example
20
00:01:36,370 --> 00:01:42,280
just say Well now a equals eight and b equals three.
21
00:01:42,280 --> 00:01:44,190
This is also wrong.
22
00:01:44,650 --> 00:01:50,790
So have a think about how you can solve this challenge given all of these constraints.
23
00:01:50,890 --> 00:01:55,180
And over here I've got a code playground set up for you.
24
00:01:55,180 --> 00:02:00,490
So when you click on it you should be taken to the same file where you can write your code and you can
25
00:02:00,490 --> 00:02:03,150
use this playground to test out your code.
26
00:02:03,160 --> 00:02:10,740
So for example at the moment if I just click run then it's going to log that a is 3 and B is 8.
27
00:02:10,750 --> 00:02:17,700
Now what we want to happen is when we hit run it should say the opposite a is a and b is three.
28
00:02:17,710 --> 00:02:23,560
So how we play around with the code and use the rappel it to test out your code and your hypotheses
29
00:02:23,920 --> 00:02:27,600
and hit run to see if it actually does what you expect it to.
30
00:02:27,700 --> 00:02:32,500
And then once you think you've got the solution then go ahead and write them in your code file here
31
00:02:32,890 --> 00:02:38,140
and you can click on checked solution to see if you got the answer right now.
32
00:02:38,200 --> 00:02:43,350
Once you're done you can click continue and I'll talk you through the solution code.
33
00:02:43,450 --> 00:02:46,950
So head over to the next lesson and start the code challenge.
3518
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.