freeCodeCamp/guide/english/certifications/javascript-algorithms-and-d.../basic-javascript/passing-values-to-functions.../index.md

20 lines
697 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Passing Values to Functions with Arguments
---
## Passing Values to Functions with Arguments
<!-- The article goes here, in GitHub-flavored Markdown. Feel free to add YouTube videos, images, and CodePen/JSBin embeds -->
Our task is to create a function that has **parameters**. These are inputs that determine the function's output. You place paramaters inside the `()`, like so:
```javascript
function functionWithArgs(one, two) {
console.log(one + two);
}
```
We now have to add code inside the brackets. Our task is to add `one` and `two`, and print the sum to the console. Here is the basic code solution:
```javascript
functionWithArgs(7, 3);
//This will console log 10.
```