Clarifying "this"

I think I just had a click moment, but I’m hoping for clarification from someone with greater experience.

In a function, when calling “this” with dot notation, it’s creating an object. For example:

function myName(name) { = name;

would result in an object called name, with a key of name made up of whatever name was entered as a parameter:

would result in creating this object:

myName {
name: “Jacob”

I realized this after console logging “typeof this” and it gave me “object”.

Is this correct? Am I close? Or am I way off? Inquiring minds want to know!

(And yes, I’m sure this has been covered already in the course, but my brain has only just now processed the logic. Yeesh!)

1 Like

And it allows you to do this:

let myName = {
  name: "Jacob",
  logName: function() {
myName.logName(); // Jacob

Awesome! Thanks for the feedback!