This is a very simple example function which satisfies the criteria
According to Mozilla Developer Network:
The escape
and unescape
functions are deprecated. Use encodeURI
, encodeURIComponent
, decodeURI
or decodeURIComponent
to encode and decode escape sequences for special characters.