Having this template literal:
`HH:MM${myValue? '' : ', XXX'}${anotherValue} - `
I want to replace the hyphen at the end (-) with en dash (–) by using its code –.
I tried several methods but none of them worked. For example:
`HH:MM${myValue? '' : ', XXX'}${anotherValue} – `
and
`HH:MM${myValue? '' : ', XXX'}${anotherValue} + '–'`
Any ideas how to do this?
You can't use html entities in a template literal. But you can use the unicode equivalent of the –:
`HH:MM${myValue? '' : ', XXX'}${anotherValue} \u2013 `
See here: https://www.fileformat.info/info/unicode/char/2013/index.htm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With