Basic JavaScript - Passing Values to Functions with Arguments

I’ve passed 3 out of 4 tasks.

The only task that I cannot pass is is this:
" functionWithArgs(1,2) should output 3 ."

Note: The “num1,num2” is coming from the tutorial video that I watched but it also didnt work…

Your code so far

function functionWithArgs(num1, num2){

functionWithArgs(1,2);//Outputs 3
functionWithArgs(7,9);//Outputs 16

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic JavaScript - Passing Values to Functions with Arguments

Link to the challenge:

You are coding to the tests rather than coding to the generic solution.

Pretend you don’t know what the values in num1 and num2 will be.

Also, when you pass values into a function chances are you will want to use them in the body of the function :slightly_smiling_face:

1 Like

The num1 and num2 are called parameters that will receive arguments to "inject"in the function. The function will take these numbers and use in something, for example: equation.
When you write:

You are not using (num1 neither num 2), you simply put the numbers inside the console.log. You have to use the parameters.

1 Like

This might seem like nitpicking but it is a pet peeve of mine.

num1 and num2 are parameters they receive arguments when the function is called.

  • parameters are part of the function definition. They are just local variables.

  • arguments are part of the function invocation. They are values passed to the function at time of invocation.

// parameters
function functionWithArgs(firstNumber, secondNumber) {
  console.log(firstNumber === 42) // true
  console.log(secondNumber === 12) // true

// arguments
functionWithArgs(42, 12);
1 Like

Hey Lasjorg,

Nitpick away! any feedback coming my way is gold dust. I’m trying to learn the definitions as I go along and work on the problem

Hi bbsmooth,

thanks for the comment… I’ll try and go over a few of the challenges to see if i’m missing anything to understand exactly what your example means.

All the best.

Hi Joaodiniz,

Would this not count as an argument?:


@bbsmooth @joaodiniz lasjorg

I GOT IT!! just as I was about to log off. thanks for the help.