JavaScript String fromCodePoint()

Last Updated On Saturday 9th Apr 2022

The JavaScript String fromCodePoint() method returns a string created by using the given sequence of code points.

Syntax

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

Parameters

  • num1, num2, ..., numN – A sequence of code points.

Return Value

  • Returns a string created by using the specified sequence of code points.

Notes:

  • The fromCodePoint() method throws a RangeError if an invalid Unicode code point is given.
  • The fromCodePoint() method returns a string and not a String object.

Example: Using fromCodePoint() method

	const str1 = String.fromCodePoint(65, 66, 67);
console.log(str1);

const str2 = String.fromCodePoint(0x1f303);
console.log(str2);
	

Output

	ABC
🌃