Skip to content
Advertisement

MessageFormat not formatting when single quotes are included

I am passing in text which is combination of {} filler and text. I am trying to fill {} with some values and tried using MessageFormat.

JavaScript

OUTPUT

JavaScript

Advertisement

Answer

The single quote must be escaped using a double single quote:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement