How can I convert a character to its ASCII code using JavaScript?
For example:
get 10 from "\n".
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is the documentation for
charCodeAt:If you need to support non-BMP Unicode characters like U+1F602 , then don’t use
charCodeAt, as it will not return 128514 (or 0x1f602 in hexadecimal), it will give a result you don’t expect: