function showFullName() { alert( this.firstName + " " + this.lastName ); } var user = { firstName: "Василий", lastName: "Петров" }; showFullName.call(user) // "Василий Петров" 

When calling this function without a call , it will output undefined undefined . But why? If I passed the user argument to it, and its this becomes the user . Why without call it does not display firstName and lastname ?

    1 answer 1

    When you pass the user argument, its this does not become user. The first argument equal to user does not appear. And this depends on the context of the call (apparently in your case it will be a window). But using call and bind, you can change it this