Home > Software design >  Concatenate unicode character (warning sign) with string in javascript
Concatenate unicode character (warning sign) with string in javascript

Time:02-11

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

I tried the following but didnt succeed

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

CodePudding user response:

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

Edit:

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

  • Related