Escape dollar sign in JavaScript template literals (template strings)
var response = `I consent to my credit card being charged in the amount of
$${ total } for the purchase of ${ item.title } and any
applicable sales tax.`
The only case where $
does not produce the literal $
is before a {
, otherwise you do not need to escape it.
var response = `You have $${money}`
does work therefore. In case you need to escape anything, the backslash \
is the escape character in template strings as well, so (while unnecessary) the following works as well:
var response = `You have \$${money}`
This works for me.
var response = `You have \$\{money}`;
Putting a backslash in front of the dollar sign was the first thing that comes to my mind and it works:
\${DEPLOYMENT_NAME}