Checking value of document.body.style.backgroundImage (with value I just set it to) doesn't give me anything

1 week ago 10
ARTICLE AD BOX

I have this inside of my index.html, which looks to me like it would log "yeah" in the console but it doesn't. It switches the background but the if statement is giving me trouble. I'm checking for the exact same thing that I just set (backgroundImage) and checking with the exact same value I just set it to, but it doesn't do anything. All the syntax seems right to me from looking at documentation.

document.body.style.backgroundImage = "url('images/background/sunset.jpg')"; console.log(document.body.style.backgroundImage); if (document.body.style.backgroundImage == "url('images/background/sunset.jpg')") { console.log("yeah"); }

Console gives me this

url("images/background/sunset.jpg")

But doesn't say "yeah". Can't figure out what the issue is.

Read Entire Article