Now that we have a better understanding of objects and strings, I am going to show you more functions that you can apply on strings. First of all, I want you to get to Google untied Mozilla JavaScript. And you will find this website called JavaScript in the Mozilla and this is the main source for functions and everything about JavaScript. So it's developer.mozilla.org. Click on it. And you will get everything about JavaScript.
Here many functions, many things, functions, classes, errors. You can learn a lot from this. And you can check functions for each object you can think of, and they want you here on the search bar, click on it and search for string just type string and then hit enter. And you will find here are the various results with to click on it, and as you can see, it's the it's going to give you a complete guide on how to create screen. And it's also going to give you a lot of functions and how to use strings and what each function does. So here for example, strings can also be created using the string global object directly.
As you can see, as we learned before, you can create a string this way. And you can also here find very useful things that you can do with the strings. For example, if you add this simple, it's gonna single code, it's going to add a single code. And if you add a backslash B, it's going to backspace too many things, many useful things that you can try. And also a very important function that I want to show you is called replace, which is going to replace a string with another string. distances, you have the links, you have character, and you can get the character up.
So let's now get to Sublime Text and try many of these. So here I'm going to open Sublime Text along with Google Chrome so that we can follow along. So first of all, let's create a simple string var text equals, then this is my name. So this is the first version. The second version, as we know is var, var text one equals to equals to new, and then string. And then you just pass the same text here or any text you want.
And I'm going to pass it here. And these are the two versions of creating strings in JavaScript. And let's now try some functions. The first function that I'm going to show you today is called length. So for example, console dot log, and I'm going to use console, I'm going to use the second version, the x one, and then link. If I save and run, I am going to get the number of characters inside the string.
And by the way, it's going to also take in, take into account spaces. So spaces are considered characters. So here 1-234-567-8910 1112 1314 and 15. And that is true. So length will just return the number of strings, the number of characters inside the string. Let's try another function.
This function is very important. And it's, it's being used a lot. And what it does, it combines the text of two strings and returns a new string. So let's use this function. In con cat. And to use this function, you can just to know the how to use this function, you just can click on it, so I'm going to click on it, and it's gonna give me it's gonna give me instructions and even example.
So as you can see here, this is an example the first swing is called law. The second string is called world, and it uses the first string and then dot concat. And then here, I space and then the second string and the output will be this. So let's now try this on our, our, in our case, I'm going to change the second string to john. And this is or my name, just my name here. My name is instead, my name is and I am going to use it as we did here.
I'm gonna change this to just x dot concat. And then I'm going to pass just on nothing just empty string and then the second parameter will be the next the second stream which is the next one. If now I save and run, I am going to get my name is john