Trying to change Steam backgrounds randomly with Tempermonkey, always getting "Parsing Error: Unexpected Token" error

Mugen :

Here, my code

(function() {
    'use strict';

    var imagesArray = [

        "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/items/583660/361fda7dfb819158079afbf50b7ca13d1ffa6468.jpg",
        "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/items/203770/c6f5ea583b7883659e35fbedf1b21220dc230dda.jpg"

                  ];

function setBackground(){
    const background = document.querySelector('.profile_background_image_content')
    const randomImage = imagesArray[Math.floor(Math.random() * imagesArray.length + 1)]
    background.style.backgroundImage = url(${randomImage}) !important
}

setBackground()

})();

Well, i honestly don't know why it gives the error or i am doing the correct thing. I would appreciate the help.

Mugen :

That worked

(function() {
    'use strict';

    document.addEventListener("DOMContentLoaded", function() {

        var imagesArray = [
            "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/items/583660/361fda7dfb819158079afbf50b7ca13d1ffa6468.jpg",
            "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/items/203770/c6f5ea583b7883659e35fbedf1b21220dc230dda.jpg"
        ];

        const background = document.querySelector('div.profile_page');
        const randomImage = imagesArray[Math.floor(Math.random() * imagesArray.length)];
        background.style.backgroundImage = 'url('+randomImage+')';
        background.style.backgroundColor = 'black';
        background.style.backgroundSize = 'contain';

    });

})();

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=30091&siteId=1