Tell us what’s happening:
Your code so far
function fucntionWithArgs(param1,param2){
console.log(1+2);
}
function functionWithArgs(param1,param2){
console.log(7+9);
}
functionWithArgs(1,2);
functionWithArgs(7,9);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
.
Challenge: Passing Values to Functions with Arguments
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
You should only create a single function named functionWithArgs . What do you think param1 and param2 represent if I call the function as below?
functionWithArgs(1,2);
agongtsang:
function fucntionWithArgs(param1,param2){ console.log(1+2); } function functionWithArgs(param1,param2){ console.log(7+9); } functionWithArgs(1,2); functionWithArgs(7,9);
Hi @agongtsang what @RandellDawson its actually right ! also you have a typo when calling the function
function fucntionWithArgs(param1,param2){
console.log(1+2);
}
calling function need to have the same name function
functionWithArgs(1,2);
If I call it, It represents 1 n 2. Is it ?
That is correct. Now inside the function, why not use param1 and param2 as indicated by the instructions (shown below):
Create a function called functionWithArgs
that accepts two arguments and outputs their sum to the dev console.
Key word here is their .
function functionWithArgs(param1,param2){
console.log(param1+param2);
}
functionWithArgs(1,2);
functionWithArgs(7,9);
1 Like