The escape () function encodes a string .
This m * ake function wraps the string *, so it can be transmitted over any network to any computer that supports ASCII characters.
This function encodes special characters.
Now this function is something specific to strings that are URLs in a browser-based environment, JS as a language does not depend on it.
Thus, when you run escape, unescape also in String will become useless in non-network / URL scripts.
This is why they are part of the Window object .
You want it in a string, you can add it to a String prototype.
source share