Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can i convert ascii code to character in javascript

how can i convert ascii code to character in javascript

like image 879
Deepa Avatar asked Mar 09 '11 11:03

Deepa


People also ask

Can we use ASCII values in JavaScript?

charCodeAt() Function to Convert Character to ASCII in JavaScript. The charCodeAt() function defined on string prototype returns the Unicode value i.e. UTF-16 code at the specified index. It returns a value in the range 0 to 216 - 1 i.e. 65535 . The codes 0 to 127 in UTF codes are same as the ASCII code.

How do you convert ASCII to string?

To convert ASCII to string, use the toString() method. Using this method will return the associated character.


2 Answers

String.fromCharCode(ascii_code) 
like image 83
Darko Kenda Avatar answered Oct 15 '22 15:10

Darko Kenda


If you want to convert Ascii Codes to Characters you can use:

String.fromCharCode(codes); 

For Example:

String.fromCharCode(65,66,67);  which returns = "ABC" 
like image 28
Saleheen Noor Avatar answered Oct 15 '22 13:10

Saleheen Noor