How to use the Unicode number values In Javascript

You can use the Unicode number values for different kinds of symbols or characters by using the \u escape sequence before each hexadecimal value.

Syntax:

\uXXXX

Here, XXXX stands for different hexadecimal values for different symbols.

Example: The below code will explain the use of the Unicode number values to add Unicode characters in JavaScript.

JavaScript
const copyRight = '\u00A9';
const hash = '\u0023';
console.log(copyRight);
console.log(hash);

Output
©
#

How to Insert Unicode in JavaScript ?

Unicode is a computing standard for consistent encoding, representation, and handling of text. Unicode characters are necessary when making multilingual applications or working with special symbols and emojis in JavaScript. It provides unique numbers for each character. UTF-8 is a popular Unicode encoding standard that has 8-bit units.

The below approaches can be used to insert Unicode in JavaScript.

Table of Content

  • Using the Unicode number values
  • Using the String.fromCodePoint() method

Similar Reads

Using the Unicode number values

You can use the Unicode number values for different kinds of symbols or characters by using the \u escape sequence before each hexadecimal value....

Using the String.fromCodePoint() method

JavaScript provides a String.fromCodePoint() method that creates a string from a sequence of unicode code points. This method takes one or more arguments as input and return their corresponding characters....