so i have a command like so:
body.style.backgroundImage = `${"url('./images/3.jpg')"}`
Is there a way i can change the number of the jpg using a variable despite it being encased in a ''? or do i have to replace my structure entirely?
CodePudding user response:
Try this:
var num = 3
body.style.backgroundImage = `url('./images/${num}.jpg')`