# Variable as function parameter in JavaScript

You can pass variables to function parameters. Let's look at an example. Let's say we have the following function:

`function func(num) { console.log(num ** 2); }`

Let's have a variable:

`let param = 2;`

Let's call our function, passing it the number from the variable as a parameter:

`let param = 2; func(param);`

Make the function `func` that will take `3` numbers as parameters and output their sum to the console. Let `3` variables with numbers are given:

`let param1 = 1; let param2 = 2; let param3 = 3;`

Use the function you created to print the sum of the values of these variables to the console.

←→
↑
en ru