-
-
Save IrhaAli/7644323c9483ea9928c14b5eb457470b to your computer and use it in GitHub Desktop.
Decodes a given url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const urlDecode = function(text) { | |
let elements = text.split('&'); | |
let obj = {}; | |
for (let i = 0; i < elements.length; i++){ | |
let elementInfo = elements[i].split('='); | |
obj[elementInfo[0]] = elementInfo[1].replaceAll('%20', ' '); | |
} | |
return obj; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment