const sentence = ' Name: ${fname} ${lname} </br> Email: ${email} </br> '
let valuesObj={
"fname": "sant",
"lname": "G",
"email": "Test@test.com"
}
tried this code but no use:
function replaceAll(str, map){
for(key in map){
str = str.replaceAll(key, map[key]);
}
return str;
}
var newString = replaceAll(sentence , valuesObj);
console.log(newString)
Expected out put is :
Name: sant G
Email:Test@test.com
how to do this Using NodeJs or Javascript