var variable = 2;
var x = `${variable}`;
console.log(x) to output `${variable}`
not 2 thank you. am new to programming
You can escape the backticks:
var variable = 2;
var x = `\`${variable}\``;
console.log(x)
Welcome to Programming. Depending on the overall goal here, I would maybe set another variable, say y to the string of the template literal.
var y = '`${variable}`'
Unfortunately, Javascript will always evaluate the value stored in a variable storing a primitive data type like a string or number.