Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 16, 2021 11:51 am GMT

JS Tip: Create Emoji Characters in JavaScript using String.fromCodePoint();

The String.fromCodePoint() method was added to ECMAScript 2015. The result of this method is a string (and not a String object).
Because fromCodePoint() is a static String method, you must call it as String.

let smile = String.fromCodePoint(128516); // '128516' is character codelet str = `I got you ${smile}!`;console.log(str);// output: "I got you !" 

You can create emoji characters in JavaScript using String.fromCodePoint( );

Syntax

Here is the syntax:

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

Initially created on Twitter

If you liked this article, be sure to it.


Original Link: https://dev.to/iamatifriaz/js-tip-create-emoji-characters-in-javascript-using-string-fromcodepoint-20nh

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To