I'm trying to re-use a template literal in javascript.
This isn't working:
let int;
let temp= `Number is: ${int}`;
console.log(temp)
// Number is: undefined
int = 1;
console.log(temp)
// Number is: undefined
int = 2;
console.log(temp)
// Number is: undefined
I thought that changing int
variable will dynamicaly change in the template. but i learned otherwise :D
Is it even possible and if so what is the right way of doing it?
Thanks.