Expert Developer JavaScript Question:
Download Questions PDF

What is encodeURI() function?

Expert JavaScript Developer Interview Question
Expert JavaScript Developer Interview Question

Answer:

► encodeURI() function is used to encode the URI.
► This function does not encode following special characters :
' = , ? : $ @ / & # + '
► Syntax : encodeURI(uri), Where uri is URI to be encoded.
► For example :
<script>
var uri = "EmpDetails.asp?Emp=årpit&mode=edit";
document.write(encodeURI(uri) + "
");
</script>
Output :
EmpDetails.asp?Emp=%C3%A5&mode=edit.

Download Expert JavaScript Developer Interview Questions And Answers PDF

Previous QuestionNext Question
How do I add a JavaScript event handler to an HTML page element?What is decodeURI() function?