Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to disable this error warning in jslint?

Can someone please show me how to remove this error from appearing in jslint?

How do I disable it?

This does not work: /*jslint for:true*/

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

https://www.jslint.com/

I was told: https://jsfiddle.net/xrs21efw/

The correct solution is to use forEach method of the NodeList instead
of for loop.

function onYouTubeIframeAPIReady() {
    let playerVarsList = {
        "0": {
            playerVars: {
                playlist: "0dgNc5S8cLI,mnfmQe8Mv1g,-Xgi_way56U,CHahce95B1g"
            }
        },
        "3": {
            videoId: "0dgNc5S8cLI"
        },
        "5": {
            playerVars: {
                list: "PLYeOyMz9C9kYmnPHfw5-ItOxYBiMG4amq",
                listType: "playlist"
            }
        },
        "7": {
            playerVars: {
                end: 1800,
                playlist: "0dgNc5S8cLI,mnfmQe8Mv1g,-Xgi_way56U,CHahce95B1g",
                start: 150

            }

        }
    };
    //to add the player to all the play buttons
    const totalP = document.querySelectorAll("[data-container=\"play1\"]");
    //looping over all the play buttons and adding player to that

    for (let i = 0; i < totalP.length; i++) {

        players.add(".playSingle" + i, (playerVarsList[i] || {}));
    }
    players.add(".playInitial", {});

}

enter image description here

enter image description here

>Solution :

try the following:

totalP.forEach((_, index) => {
            players.add(".playSingle" + index, (playerVarsList[index] || {}));
    })
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading