Convert character to ASCII code in JavaScript

How can I convert a character to its ASCII code using JavaScript?

For example:

get 10 from "\n".

53 thoughts on “Convert character to ASCII code in JavaScript”