Explain unescape() and escape() in JavaScript?

Explain unescape() and escape() in JavaScript?

Explain unescape() and escape() in JavaScript?

View Answers

November 11, 2010 at 11:41 AM

The escape() function encodes a string.

This function makes a string portable, so it can be transmitted across any network to any computer that supports ASCII characters.

This function encodes special characters, with the exception of: * @ - _ + . /

<script type="text/javascript">

document.write(escape("Need tips? Visit here"));

</script>

The unescape() function decodes an encoded string.

<script type="text/javascript">

str="Need tips? Visit here";
str_escape=escape(str);
document.write(str_escape + "<br />")
document.write(unescape(str_escape))

</script>









Related Tutorials/Questions & Answers:

Ads