An Interest In:
Web News this Week
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
September 16, 2021 11:51 am GMT
Original Link: https://dev.to/iamatifriaz/js-tip-create-emoji-characters-in-javascript-using-string-fromcodepoint-20nh
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 !"
Syntax
Here is the syntax:
String.fromCodePoint(num1)String.fromCodePoint(num1, num2)String.fromCodePoint(num1, num2, ..., numN)
Initially created on Twitter
JS Tip :
You can create emoji characters in JavaScript using String.fromCodePoint( );
Give it a try
#javascriptdeveloper #javascript14:40 PM - 14 Sep 2021
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:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To