0 1 00:00:00,740 --> 00: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 2 00:00:06,920 --> 00:00:08,260 toUpperCase() 2 3 00:00:08,420 --> 00:00:12,890 that changes all of the characters in your string to uppercase. 3 4 00:00:12,890 --> 00: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 5 00:00:19,220 --> 00:00:24,070 to turn every single character in the string to the uppercase version of it. 5 6 00:00:24,350 --> 00:00:26,750 So let me show you what this looks like in real life. 6 7 00:00:26,810 --> 00:00:31,670 So I have a variable that is called name and it contains the string Angela. 7 8 00:00:31,700 --> 00:00:38,990 Now, if I write name.toUppercase, and then I add some empty parentheses, and finish off my statement 8 9 00:00:39,080 --> 00:00:40,870 with a semi-colon, 9 10 00:00:40,870 --> 00: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 11 00:00:47,060 --> 00:00:51,980 printed out with every single character changed to the upper case. 11 12 00:00:52,020 --> 00:00:57,200 Now at the moment this functionality is completed and then this data is lost. 12 13 00:00:57,200 --> 00: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 14 00:01:04,430 --> 00: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 15 00:01:12,020 --> 00:01:19,250 old version of name, which is this, changed to uppercase, and then reassigned to the same variable. 15 16 00:01:19,250 --> 00: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 17 00:01:25,730 --> 00:01:29,420 this variable, you can see it is now all capitalized. 17 18 00:01:29,420 --> 00:01:32,070 Now we can change it in the other direction as well. 18 19 00:01:32,210 --> 00:01:38,630 So, for example, if I wrote name now equals the previous version of name, which at this point is all 19 20 00:01:38,630 --> 00:01:43,200 uppercase, .toLowerCase, then 20 21 00:01:43,200 --> 00:01:48,780 now, the final version of name is actually all fully lowercase, 21 22 00:01:48,890 --> 00:01:53,250 even the first a. It’s all been turned into lowercase. 22 23 00:01:53,270 --> 00: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 24 00:01:59,630 --> 00:02:05,220 for, say, a prompt and you ask them for ‘What is your name?’. 24 25 00:02:05,270 --> 00:02:10,380 And they end up giving you their name in, say, all lowercase, right? 25 26 00:02:10,610 --> 00:02:18,500 And that doesn't really look very good when you print it out, say in an alert. 26 27 00:02:18,710 --> 00:02:23,030 It doesn't look that great and it won't be consistent across different users. 27 28 00:02:23,030 --> 00:02:29,150 Now if you've been watching along with the previous lessons and you've absorbed the knowledge then you 28 29 00:02:29,150 --> 00:02:37,280 should now be able to use everything that you've learnt including how to slice strings up, how to concatenate 29 30 00:02:37,280 --> 00:02:43,430 strings, and also how to change the casing in order to complete the next challenge. 30 31 00:02:43,670 --> 00:02:49,350 So what I want you to do is to create a prompt that asks the user for their name, 31 32 00:02:49,520 --> 00: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 33 00:02:57,470 --> 00:02:58,860 that says Hello, 33 34 00:02:59,060 --> 00:03:06,680 and then their name, so for example Angela, but the name has to be capitalized, but only for the first 34 35 00:03:06,680 --> 00:03:09,930 character and none of the rest of the characters. 35 36 00:03:09,950 --> 00:03:12,210 So I want you to think about this problem, 36 37 00:03:12,230 --> 00:03:17,570 and break it down into smaller chunks that you can tackle one at a time. 37 38 00:03:17,570 --> 00:03:24,680 Now, while there are much easier ways of doing it if you search Stack Overflow or Google, I want you 38 39 00:03:24,680 --> 00:03:28,480 to only use the things that we've talked about in this module. 39 40 00:03:28,640 --> 00:03:34,810 So everything that you need to complete this challenge is within the lessons of this module. 40 41 00:03:34,850 --> 00:03:39,710 So pause the video now and see if you can complete this challenge.