<v Instructor>As I mentioned in the last section,</v> JavaScript strings have only one property, which is length, we've just seen a lot about that, but they actually do have a lot of methods. So a method is a function that is attached to an object and a function is something that takes in information and returns a value. Sometimes that information is nothing and in fact, that's a very common case where it doesn't need any more information than the object itself. So let's take a look at an example of that. So here's a string. I'm gonna do an uppercase string like this. (keyboard typing) HONEY BADGER, all caps. And we're going to say, let's make this into a lowercase version of that. So there is a method associated with strings called toLowerCase. And it's camel case as with variables with a leading lower case like this, TO lowercase and then lowercase. Right now, if this were a property, I would hit return here and it would work. But here, it says, "Ah, it's a function." Remember, I just said that methods were functions. This is a function called toLowerCase. In order to call that function, in order to activate it, I have to give it an argument, which in this case is nil, nothing. There's no argument so you just do open paren, close paren like this, semicolon, optionally, and then like that. So this converts the string into a lowercase version of itself, and it works with mixed case strings too, you could do something like this, that same thing. This is the sort of thing you might use in a web application to standardize on a lower case version of an email address. For example, we had in a previous section first name close Michael, and if we wanted to have the email address, we could say, have the username be standardized on the lowercase version of this. And then the email address could be something like this with interpolation with the back tick. Username@.example.com and there we go. So even though the Honey badger don't care about being lowercased, we can reverse it if we want and restore the Honey badger to all caps by calling the toUpperCase method. So let's take a look at that. In fact, let's bind this sometimes it's called a variable binding. Lower Honey badger like this. We can type it in actually let me just highlight it like that, Honey badger. And so what I can do here is see if you can guess if toLowerCase converts a string to lowercase, how would you convert it to uppercase? So this is classic technical sophistication. Just being able to guess the right answer. Hmm, If there's a toLowerCase method in JavaScript there's probably a toUpperCase. Indeed. It's useful to be able to look these things up though. So let's take a look at the Mozilla Developer Network documentation just to reinforce this. So here is the Mozilla Developer Network or MDN web doc for string. We search for uppercase. You can see that we just look around there it is. Now, this is the kind of thing where you might be a little confused string.prototype.toUpperCase(), what does that mean? And the answer is, well, we'll talk about that later in this tutorial, but you don't really have to know. You can guess that well, I don't know what the string.prototype is but apparently it involves something with a prototypical string. So a prototypical string like this can be uppercase using this method. If you click on it you can see that it has examples like this. So this is a great source for learning about methods for any given object. Let's take a look at another example. This is a useful method called includes, which as it says here, determines whether one string may be found within another string. We click through again, we have some examples. So here's an example from the famous soliloquy in Shakespeare's play Hamlet. Let's adapt this example for our own uses. Remember I mentioned before that var is really common. Well, here it is, but we're gonna use let and we're gonna change this period to a colon because that's actually what it is in the original. Just get the quote exactly right. This is now our string and actually rather than calling it string I wanna give it something a little bit more descriptive, I'll call it soliloquy because this is from the famous to be or not to be soliloquy from Hamlet. All right if we go back to the examples we can see that this includes method, as you might guess tells us whether or not a particular substring is in the original string. So does this original string include the substring? So you can think of it as the answer to the question, string includes to be? Well, let's take a look. It does that's true. So that's the first example. This is a really useful way to increase your JavaScript knowledge is just to go through the documentation, look at the examples and then type them in maybe literally or maybe modify them a little bit as we have here. So string.includes question. It should be true, right? Because of this here includes non-existent. So that's not their false and do this here. Is it case sensitive? seems likely that will be and it is, so the soliloquy does not include to be all caps. Then here we've got to be comma one. So it's actually left as an exercise to figure this out but I'll probably mention it here. So to be comma one, well, this string capital To space be definitely appears, but this is false because this one is saying, start from the number one element in the string. Now you might wonder, well, wait a minute, this is the first element TO BE. Why isn't it true? And the answer is because strings, as we'll discuss more in the next section are what are called zero offset. So they actually start at zero instead of one. If we go say to O B comma one, that's saying all right, if we go from element zero to element one so that's the one here, does this string O space BE appear in this soliloquy starting with an index of one? And the answer is yes, it does so this should be true. There we go. So we've just covered a few examples of the many different methods on strings. If you look here, can see that there are a bunch you can learn an awful lot about strings just by reading through, clicking and looking at examples. More realistically what'll happen is you'll be making a program and you'll want to do something with strings and you'll think, aha maybe there's a way to do this already. And you'll go to the documentation and read through it and find out if in fact it's already been solved and you'll be amazed with a mature language like JavaScript just how often the exact thing you want to do is covered in the documentation.