Preventing the browser from reading the YouTube code until the image was clicked

No, I gave you very clear instructions on how to recognise object keys. Read this again.

obj[key] 
return obj;

No, that’s not correct.

Do you understand what I mean when I use the word, colon?

: That

 width: 200,
      height: 200,
      videoId: videoId,

Yes, those are key/value pairs. So what are some examples of keys from that?

width
height
videoId

Good one. You now have a better understanding of what object keys are.

2 Likes
key: playerVars,
        obj[key] = playerVars[key];
        return obj;
    }, defaultPlayerVars);
    new YT.Player(video, {
      key: playerVars,
      width: 200,
      height: 200,
      videoId: videoId,
      // defaultPlayerVars,
      combinedPlayerVars,
      events: {
        "onReady": onPlayerReady
      }
    });
  }

The name of combinedPlayerVars needs to stay the same, as that is the value of the key/value pair.
You just need to give it a key called playerVars and that should temporarily fix the problem.

Didn’t I do that here?

key: playerVars,
       obj[key] = playerVars[key];
        return obj;
    }, defaultPlayerVars);
    new YT.Player(video, {
      key: playerVars,
      width: 200,
      height: 200,
      videoId: videoId,
      // defaultPlayerVars,
      combinedPlayerVars,
      events: {
        "onReady": onPlayerReady
      }
    });
  }

No you did not. Adding new lines of code is absolutely the wrong thing to do.

Then what am I supposed to do?

This:

playerVars:

 obj[key] = playerVars[key];
        return obj;
    }, defaultPlayerVars);
    new YT.Player(video, {
      playerVars:
      width: 200,
      height: 200,
      videoId: videoId,
      // defaultPlayerVars,
      combinedPlayerVars,
      events: {
        "onReady": onPlayerReady
      }
    });
  }

It’s been said many times before.

If there’s anything else in there that you have trouble understanding, we can help to supply details about that too.

1 Like

This is all I add in?

playerVars:

I can’t get past step 1.

I’ve been realizing that just giving code is the completely wrong thing to do, for nothing is learned.

Instead, by explaining things in words and terms that are extremely common to JavaScript, much more has the opportunity to be learned instead.

1 Like

Correct.

1 Like

What happened?


    const combinedPlayerVars = Object.assign(defaultPlayerVars, playerVars);
    new YT.Player(video, {
      playerVars:
      width: 200,
      height: 200,
      videoId: videoId,
      // defaultPlayerVars,
      combinedPlayerVars,
      events: {
        "onReady": onPlayerReady
      }
    });

Ahh, not correct.

That is the key, which must be matched up with the appropriate value, which in this case is combinedPlayerVars. Together they then make a key/value pair.