WEBVTT 0 00:00.740 --> 00:06.740 Now, the last thing that I want to show you that you can do with strings is, you can use a method called 1 00:06.920 --> 00:08.260 toUpperCase() 2 00:08.420 --> 00:12.890 that changes all of the characters in your string to uppercase. 3 00:12.890 --> 00:19.100 So as we have done before, we simply take the variable, and then we write a dot, and then we use toUpperCase 4 00:19.220 --> 00:24.070 to turn every single character in the string to the uppercase version of it. 5 00:24.350 --> 00:26.750 So let me show you what this looks like in real life. 6 00:26.810 --> 00:31.670 So I have a variable that is called name and it contains the string Angela. 7 00:31.700 --> 00:38.990 Now, if I write name.toUppercase, and then I add some empty parentheses, and finish off my statement 8 00:39.080 --> 00:40.870 with a semi-colon, 9 00:40.870 --> 00:46.760 and now if I hit command enter, you can see that in the console I get the string that's contained a name 10 00:47.060 --> 00:51.980 printed out with every single character changed to the upper case. 11 00:52.020 --> 00:57.200 Now at the moment this functionality is completed and then this data is lost. 12 00:57.200 --> 01:04.410 So inside here, for example if I just wrote name, which is my variable, you can see that it's still lowercase. 13 01:04.430 --> 01:11.960 So if you wanted this to be saved to this variable then all we need to do is say that name equals the 14 01:12.020 --> 01:19.250 old version of name, which is this, changed to uppercase, and then reassigned to the same variable. 15 01:19.250 --> 01:25.730 So now if I hit run and I type name into the console to try and pull up the value that’s contained inside 16 01:25.730 --> 01:29.420 this variable, you can see it is now all capitalized. 17 01:29.420 --> 01:32.070 Now we can change it in the other direction as well. 18 01:32.210 --> 01:38.630 So, for example, if I wrote name now equals the previous version of name, which at this point is all 19 01:38.630 --> 01:43.200 uppercase, .toLowerCase, then 20 01:43.200 --> 01:48.780 now, the final version of name is actually all fully lowercase, 21 01:48.890 --> 01:53.250 even the first a. It’s all been turned into lowercase. 22 01:53.270 --> 01:59.630 Now that's pretty easy and it's pretty useful as well because sometimes you might want to ask the user 23 01:59.630 --> 02:05.220 for, say, a prompt and you ask them for ‘What is your name?’. 24 02:05.270 --> 02:10.380 And they end up giving you their name in, say, all lowercase, right? 25 02:10.610 --> 02:18.500 And that doesn't really look very good when you print it out, say in an alert. 26 02:18.710 --> 02:23.030 It doesn't look that great and it won't be consistent across different users. 27 02:23.030 --> 02:29.150 Now if you've been watching along with the previous lessons and you've absorbed the knowledge then you 28 02:29.150 --> 02:37.280 should now be able to use everything that you've learnt including how to slice strings up, how to concatenate 29 02:37.280 --> 02:43.430 strings, and also how to change the casing in order to complete the next challenge. 30 02:43.670 --> 02:49.350 So what I want you to do is to create a prompt that asks the user for their name, 31 02:49.520 --> 02:57.170 but if they give you a name that is uppercase or lowercase, I want you to be able to send them an alert 32 02:57.470 --> 02:58.860 that says Hello, 33 02:59.060 --> 03:06.680 and then their name, so for example Angela, but the name has to be capitalized, but only for the first 34 03:06.680 --> 03:09.930 character and none of the rest of the characters. 35 03:09.950 --> 03:12.210 So I want you to think about this problem, 36 03:12.230 --> 03:17.570 and break it down into smaller chunks that you can tackle one at a time. 37 03:17.570 --> 03:24.680 Now, while there are much easier ways of doing it if you search Stack Overflow or Google, I want you 38 03:24.680 --> 03:28.480 to only use the things that we've talked about in this module. 39 03:28.640 --> 03:34.810 So everything that you need to complete this challenge is within the lessons of this module. 40 03:34.850 --> 03:39.710 So pause the video now and see if you can complete this challenge.