title: How to remove config from the javascript
body: <p>Here is the code, how would I remove <code>config</code> from it?</p>
  <p><a href="https://jsfiddle.net/2w19gmjo/" rel="nofollow noreferrer">https://jsfiddle.net/2w19gmjo/</a></p>
  <p>I want to remove it entirely.</p>
  <p>The whole thing.</p>
  <pre><code>const config = {};
  </code></pre>
  <p>It may need to be replaced with something else though.</p>
  <pre><code>const videoPlayer = (function makeVideoPlayer() {
    const config = {};
  
    function loadIframeScript() {
      const tag = document.createElement(&quot;script&quot;);
      tag.src = &quot;https://www.youtube.com/iframe_api&quot;;
      const firstScriptTag = document.getElementsByTagName(&quot;script&quot;)[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
    }
  
    function onYouTubeIframeAPIReady() {
      const videoIds = config.videoIds;
      const cover = document.querySelector(&quot;.play&quot;);
      const wrapper = cover.parentElement;
      const frameContainer = wrapper.querySelector(&quot;.video&quot;);
      config.player = addPlayer(frameContainer, videoIds);
    }
  
    function isPlaylist(videoIds) {
      return Array.isArray(videoIds) &amp;&amp; videoIds.length;
    }
  
    function shufflePlaylist(player) {
      player.setShuffle(true);
      player.playVideoAt(0);
      player.stopVideo();
    }
  
    function onPlayerReady(event) {
      const player = event.target;
      player.setVolume(100);
      shufflePlaylist(player);
    }
  
    function createPlaylist(videoIds) {
      return videoIds.join();
    }
  
    function createOptions(videoIds) {
      const options = {
        height: 360,
        host: &quot;https://www.youtube-nocookie.com&quot;,
        width: 640
      };
      options.playerVars = {
        autoplay: 0,
        cc_load_policy: 0,
        controls: 1,
        disablekb: 1,
        fs: 0,
        iv_load_policy: 3,
        rel: 0
      };
      options.events = {
        &quot;onReady&quot;: onPlayerReady
      };
  
      if (isPlaylist(videoIds)) {
        options.playerVars.loop = 1;
        options.playerVars.playlist = createPlaylist(videoIds);
      } else {
        options.videoId = videoIds;
      }
      return options;
    }
  
    function isVideoId(videoIds) {
       return typeof videoIds === &quot;string&quot;;
     }
  
    function getVideoId(video, videoIds) {
      const videoId = video.dataset.id;
      if (isVideoId(videoIds)) {
        return videoIds;
      }
      return videoId;
    }
  
     function getVideoIds(video, ids) {
       if (isPlaylist(ids)) {
         return ids;
       } else {
         const videoId = getVideoId(video, ids);
       return videoId;
       }
     }
  
    function createVideoOptions(video, ids) {
      const videoIds = getVideoIds(video, ids);
      const options = createOptions(videoIds);
      return options;
    }
  
    function addPlayer(video, ids) {
      const options = createVideoOptions(video, ids);
      const player = new YT.Player(video, options);
      return player;
    }
  
    function play() {
      const player = config.player;
      if (player &amp;&amp; player.playVideo) {
        player.playVideo();
      }
    }
  
    function init(videoIds) {
      config.videoIds = videoIds;
      loadIframeScript();
      window.onYouTubeIframeAPIReady = onYouTubeIframeAPIReady;
      return play;
    }
  
    return {
      init,
      play
    };
  }());
  </code></pre>