Q:

How to use hex to represent char in javascript? 

I have a c# code, I want to transfer it to javascript.  How can I use hex to represent char in js? 
the c# code is:
s = s.Replace('\r', Convert. ToChar(0x0141));

where s is string. 

A:

The equivalent function should be String.fromCharCode, so for your case it would be:
s = s.replace(/\r/g, String.fromCharCode(0x0141));

Note use '\r' if you only want to replace the first line break.  /\r/g will replace all line breaks 

