Problem Explanation
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.
functionWithArgs(7, 3);
//This will console log 10.
41 Likes
I have same code as you but I get this as failure messages:
functionWithArgs(1,2) should output 3
functionWithArgs(7,9) should output 16
23 Likes
In the end it was missing a ‘+’ sign in the console.log instead of a ,
// Only change code below this line.
function functionWithArgs(param1, param2) {
console.log(param1 + param2);
}
functionWithArgs(“Hello”, " World");
14 Likes
guys can anyone tell me that where’s the problem in this.
// Example
function ourFunctionWithArgs(a, b) {
console.log(a - b);
}
ourFunctionWithArgs(10, 5); // Outputs 5
// Only change code below this line.
function FunctionWithArgs(a, b) {
console.log(a + b);
}
FunctionWithArgs(50, 13);
5 Likes
function functionWithArgs(a,b) {
console.log(a+b);
}
functionWithArgs(1,2); \= 3
functionWithArgs(7,9); \= 16
DONE
86 Likes