Passing Values to Functions with Arguments

function functionWithArgs(param1, param2){
functionWithArgs(1,2);
console.log();
}
i’m unable to understand this

  • functionWithArgs(1,2) should output 3.

  • Failed:functionWithArgs(7,9) should output 16.

Basically you need to create a function called functionWithArgs.
Then, fill in the logic to output the sum. Also add a line to console.log it out!
Then, call a function once e.g. functionWithArgs(1,2)

1 Like

function functionWithArgs(aa1, aa2){

console.log(1+2, 7+9);

}

functionWithArgs(3,16);

}

functionWithArgs()

functionWithArgs(7,9) should output 16 .
What more improvements i have to do?

i think you should NOT have TWO functions as solution.

You can try add in this at bottom,

functionWithArgs(1,2)
functionWithArgs(7,9)

then look at the console output.
Are they 3 and 16?

If not, you need to modify this line:

console.log(1+2, 7+9);

Try replace with you argument of aa1 and aa2.

Sometimes, i read extra reference to understand more >>> JavaScript Functions

function functionWithArgs(aa1,aa2){

console.log(aa1+aa2);

}

functionWithArgs(3,16);

code successfully submitted with the above solution.

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