Please anyone explain about this

Tell us what’s happening:

  **Your code so far**

function functionWithArgs(1,2){
  **Your browser information:**

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

Challenge: Passing Values to Functions with Arguments

Link to the challenge:

Hi @rohithkumar2424 !

A couple of things.

You don’t want to hard code these numbers here.
Instead you want to come up with two parameter names.
Like mentioned in the lesson they act like placeholders for the actual values used later.

Since we are dealing with numbers your parameter names can be num1, num2 for example. or n1, n2.

You want to choose names that actually make sense in the context of the problem.
Writing something like this wouldn’t make much sense.

function functionWithArgs(cake,frog)

Once you have chosen your parameter names you should get something like this.

function functionWithArgs(num1, num2){

You have the console.log part write but what is inside the parenthesis needs to change.

The instructions ask us to output the sum.
Sum means addition.
You need to write an expression where you take parameter name 1 and add that with parameter name 2.

function functionWithArgs(num1, num2){
  console.log(//write an expression here that adds num1 and num2) 

Once you write that expression, then you can call the function.
This first part is right but what is in the parenthesis is not correct.

FCC instructions:
Call the function with two numbers as arguments.

It makes sense to use two numbers in our function call because of the parameters that we set here. function functionWithArgs(num1, num2)

Choose two numbers that will go inside the parentheses of that function call.

Everytime the function is called it will execute the code inside the function.

//the computer will execute the expression you will write
  console.log(//write an expression here that adds num1 and num2) 

And that’s it.

Hope all of that makes sense. :grinning:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.