say i have a string like this
const myObj = {"far": " bar"}
const s = "hello " + JSON.stringify(myObj)
How to convert it to template literal ?
say i have a string like this
const myObj = {"far": " bar"}
const s = "hello " + JSON.stringify(myObj)
How to convert it to template literal ?
The same way you put any other expression in a template literal, just wrap it in ${}
.
const myObj = {"far": " bar"}
const s = `hello ${JSON.stringify(myObj)}`;
console.log(s);