Expected an identifier and instead saw '}'

I can’t figure out how to resolve this issue.

jslint:

How do I fix this?

I don’t understand what it’s asking me to do.

(function iife() {
    "use strict";
    var tag = document.createElement("script");
    tag.src = "https://www.youtube.com/player_api";
    var firstScriptTag = document.getElementsByTagName("script")[0];
    firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

    function onPlayerReady(event) {
        const youtubePlayer = event.target;
        youtubePlayer.setVolume(0); // percent
    }
    window.onYouTubePlayerAPIReady = function() {
        new YT.Player(document.querySelector(".js-player"), {
            height: "315",
            width: "560",
            host: "https://www.youtube-nocookie.com",
            videoId: "M7lc1UVf-VE",
            playerVars: {
                autoplay: 0,
                controls: 1,
                showinfo: 1,
                rel: 0,
                iv_load_policy: 3,
                cc_load_policy: 0,
                fs: 0,
                disablekb: 1,
            },
            events: {
                "onReady": onPlayerReady
            }
        });
    };
}());

Often, (but not always) a comma in code signifies “another is after this, expect it to be there”. eg.

array(1,2,3,4)

vs.

array(1,2,3, )

So the code is kind of saying “wait a minute, you said there was going to be another, but there wasn’t. Error!”

3 Likes

I removed the comma off of the last one and that did it.

disablekb: 1

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.