Define unescape() and escape() functions?

The escape() and unescape() functions is to Encode and decode a string in JavaScript. The escape() function in JavaScript to make a string portable to transmit it over a network and we can use unscape() function to get back the original string.
run this source code Browser View
Source
<script> var str = "https://net-informations.com"; var str_esc = escape(str); document.write(str_esc); document.write("<br>"); document.write(unescape(str_esc)); </script>
Escaping and unescaping are useful to prevent Cross Site Scripting (XSS) attack. It is one of the common web attacks, since it will be easy to create an attack vector if the site is not designed carefully. According to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/unescape you should update your old scripts:
This feature has been removed from the Web standards. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break at any time.

How to Fix?

Fixing it could be as simple as dropping a line into your JS to add in an unescape() method if one doesn't exist.
window.unescape = window.unescape window.decodeURI;