How do you insert a variable into a character escape in javascript

  Kiến thức lập trình

I’m attempting to update the icons used in an application that has a nested webview within it. I’m currently able to load specific icons with our icon font using specific hex codes like this: “u{F053D}”. The problem I’m running into is now that I’m trying to get dynamic icons defined from elsewhere in the application, I can’t find a valid syntax to instert a variable into the place of the static hex code I was testing with.

Here are a few things I tried with hexCode representing a variable containing a string value like “F053D”:

'u{hexCode}' 'u{${hexCode}}' 'u{' + hexCode + '}'

But these say that a Hexadecimal didgit is expected after u. Is there a way to insert a hex code here dynamically that I’m missing?

New contributor

Bruic is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT