JavaScript number to unicode | Example code

Use fromCharCode() Method to number to Unicode in JavaScript. It returns a string created from the specified sequence of UTF-16 code units.

String.fromCharCode(n1, n2, ..., nX)

n1, n2, …, nX – One or more Unicode values to be converted.

JavaScript number to Unicode Example

HTML example code: String.fromCharCode to convert ASCII number (int).

Single Parameter

<html>
<body>
	<script>
		var single = String.fromCharCode(105);
		console.log(single);

	</script>
</body>
</html>

Output: i

Multiple Parameters

<html>
<body>
	<script>
		alert(String.fromCharCode(189, 43, 190, 61));

	</script>
</body>
</html>

Output:

JavaScript number to unicode

Syntexs

String.fromCharCode(num1)
String.fromCharCode(num1, num2)
String.fromCharCode(num1, num2, ..., numN)

Do comment if you have any doubts and suggestions on this JS code.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.