Hello, in this JavaScript video, I am going to show you JavaScript you are eyes. So a u ri is a Uniform Resource Identifier similar to a URL, which is this, which is the Uniform Resource Locator. And the URL you could use in a URL, for example, but you know, you don't have bases in URL. So you need to be able to encode it. Now what this example you are aware there are certain characters, and just generally cannot be represented with in this little box here where the URL is. So if you ever need data there, you can do something called encoding the you all right, and it's not very complex.
The method built in so far to say, var result equals and I'm gonna make this equal to encode you are on and then you pass in the URL, a string, which is a variable for me. It could just be a direct string in here. I'm just going to console log it, you could do whatever you want, obviously, you could put it into an API element, you could replace this right here, whatever, you know, if I do result, I'm actually going to do var on a console, log the URL beforehand Well, so, there we go. I did see the slight difference and this has been encoded any sort of special character the space has been replaced with percent 20. The this special sort of you know, a, this right here has been replaced, as well as any other important character. Well, if you want to decode it, I think you get it is literally just instead of this a poor result D and this is decode you are right and console, log this out.
As you can see, we get the original URL string back. So that's you all right within JavaScript encoding and decoding them locally for us just to provide some really cool methods. So, as far as we're concerned, it just works like that within a few lines of code. If you have any questions, feel free to pop me a message and I look forward to seeing you in the next programming video.