I am looking ways to wrap a string for example i want convert string "student"
to "$student$"
. How can i achieve that in javascript?
CodePudding user response:
You can make use of template literals like that:
const wrapIntoDollars = (string) => {
return `$${string}$`;
}
console.log(wrapIntoDollars("student"));