I have a string like '${abc}' from server.
I want change it to a placeholder string.
function handle(stringFromServer) {
// stringFromServer='${abc}'
const abc = '1';
// do sth to change it to `${abc}`
console.log(stringFromServer); // I want it print 1
}
Is there more elegant way other than parse it by regex and then call eval
function?