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

697 B

title
Passing Values to Functions with Arguments

Passing Values to Functions with Arguments

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:

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:

functionWithArgs(7, 3);
//This will console log 10.