I don't have enough rep to put this under comments to the existing answers:
unescape
is only deprecated for working with URIs (or any encoded utf-8) which is probably the case for most people's needs. encodeURIComponent
converts a js string to escaped UTF-8 and decodeURIComponent
only works on escaped UTF-8 bytes. It throws an error for something like decodeURIComponent('%a9'); // error
because extended ascii isn't valid utf-8 (even though that's still a unicode value), whereas unescape('%a9'); // ©
So you need to know your data when using decodeURIComponent.
decodeURIComponent won't work on "%C2"
or any lone byte over 0x7f
because in utf-8 that indicates part of a surrogate. However decodeURIComponent("%C2%A9") //gives you ©
Unescape wouldn't work properly on that // ©
AND it wouldn't throw an error, so unescape can lead to buggy code if you don't know your data.