> For the complete documentation index, see [llms.txt](https://dailyjournal.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dailyjournal.gitbook.io/notes/languages/javascript/built-in-objects/built-in-functions.md).

# Built-in Functions

| `call()`                                    | `apply()`                                     |
| ------------------------------------------- | --------------------------------------------- |
| `call()` method takes arguments separately. | `apply()` method takes arguments as an array. |
| call() accepts an list of arguments         | apply() accepts a single array of arguments.  |
| individual arguments of varying type        | array input with similar elements             |

```javascript
function intro(name, profession){
    console.log(name + ', ' + profession);
    console.log(this);
}
```

```javascript
intro('Steve', 'Captain America');
```

{% tabs %}
{% tab title="call()" %}

```javascript
into.call(undefined, 'Tony', 'Iron Man');
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="apply()" %}

```javascript
intro.apply(undefined, ['Natasha', 'Black Widow']);
```

{% endtab %}
{% endtabs %}

* With`call()`and`apply()`method, you can write a method that can be used on different objects.
* With`call()`and`apply()`method, we call an existing function and change the function context i.e. the value of the `this` object.

## bind()

`bind()` allows us to make a copy of the function and then change the value of the `this` object.

```javascript
let person1 = {
    name: 'John',
    getName: function(){
        return this.name;
    }
}

let person2 = { name : 'Jane' };
```

```javascript
let getNameCopy = person1.getName.bind(person2);
console.log(getNameCopy());            //Jane
```
