# Call method with parameters in JavaScript

Now let the function `func` take some parameters, let's call them `param1` and `param2`:

`function func(param1, param2) { console.log(this.value + param1 + param2); }`

When calling a function via `call`, you can pass these parameters like this:

`func.call(elem, param1, param2);`

Let the following code be given:

`<input id="elem" value="hello">` `let elem = document.querySelector('#elem'); function func(surname, name) { console.log(this.value + ', ' + name + ' ' + surname); } func(); // should output here 'hello, John Smit'`

Add the `call` method to the last line so that `'hello, John Smit'` is displayed. The word `'hello'` must come from the input value, `'John'` and `'Smit'` must be function parameters.

← →
↑
en ru