For example I have string coming from JSON:
"VALUE is more than VALUE_LIMIT"
.
I want to replace VALUE
and VALUE_LIMIT
with actual data from array, for example:
const answer = {"VALUE": 15, "VALUE_LIMIT": 5}
.
I can modify string from JSON in any way, add $ along with variables, or anything else, but it should stay as string, because JSON does not accept anything else.
String from JSON can contains arbitrary number of variables.
What the best, readable way to do this in your opinion?
I’ve tried to solve it with .replace
but I found out, I forgot what this is actually do after 1 day not touching this code.