Expert Developer JavaScript Question:
Download Job Interview Questions and Answers PDF
What are the decodeURI() and encodeURI()?
Answer:
EncodeURl() is used to convert URL into their hex coding. And DecodeURI() is used to convert the encoded URL back to normal.
<script>
var uri="my test.asp?name=ståle&car=saab";
document.write(encodeURI(uri)+ "
");
document.write(decodeURI(uri));
</script>
Output -
my%20test.asp?name=st%C3%A5le&car=saab
my test.asp?name=ståle&car=saab
<script>
var uri="my test.asp?name=ståle&car=saab";
document.write(encodeURI(uri)+ "
");
document.write(decodeURI(uri));
</script>
Output -
my%20test.asp?name=st%C3%A5le&car=saab
my test.asp?name=ståle&car=saab
Download Expert JavaScript Developer Interview Questions And Answers
PDF
Previous Question | Next Question |
Explain the unshift() method in JavaScript? | Enumerate the differences between Java and JavaScript? |