Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Concatenate unicode character (warning sign) with string in javascript

I have a unicode character for warning sign- Unicode Character “⚠” (U+26A0)
https://www.compart.com/en/unicode/U+26A0

I am trying to append this to a string variable but i am not successful in appending the image
Can anyone let me know how to append it here, Also i am trying to make the warning sign yellow in color.

for e.g.
I want the result as -> ⚠ Warning Sign

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I tried the following but didnt succeed

let result = `U+26A0` + 'Warning Sign'

>Solution :

You can use the String.fromCharCode(num1) method.

Edit:

That is, String.fromCharCode(0x26A0) + " Warning Sign"

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading