January 2018
Beginner
658 pages
13h 10m
English
Now the alternative to encodeURIComponent is. This will take an encoded string like the one in the previous example, and take all the special characters, like %20, and convert them back into their original values, in this case space. For this, inside of decodeURIComponent once again we'll pass a string.
Let's go ahead and type our first and last name. In my case it's Andrew, and instead of a space between them I'll add %20, which we know is the encoded character for a space. Since we're trying to decode something, it's important to have some encoded characters here. Once yours looks like the following code with your first and last name, you can go ahead and hit enter, and what we get back is the decoded version:
decodeURIComponent('Andrew%20Mead') ...Read now
Unlock full access