I am trying to implement string interpolation by letting user provide template from the form.
Consider these inputs:
- Input with id
mapping_template - Input with id
key - Input with id
value
When users type following in inputs:
mapping_templatehas value${key} = ${value}keyhas valuea keyvaluehas valuethe value
This is my function, I invoke it like so interpolateMappingTemplate (mapping_template, 'a key', 'the value') :
var interpolateMappingTemplate = function(mappingTemplate, key, value) {
return `${templateString}`;
}
I was expecting when I interpolate template to get this a key = the value but instead my function outputs ${key} = ${value}.
What am I doing wrong here?