The escape()
function was deprecated in JavaScript version 1.5.
Use encodeURI() or encodeURIComponent() instead.
escape |
Yes | Yes | Yes | Yes | Yes |
escape(string)
Parameter | Description |
---|---|
string | Required. The string to be encoded |
A String type value representing the encoded string.
The following code shows how to Encode a string.
<!DOCTYPE html>
<html>
<body>
<script>
document.write(escape("abc!"));
</script>
</body>
</html>
The code above is rendered as follows: