Will anyone tell me where I went wrong?

Tell us what’s happening:

Your code so far


function functionWithArgs(1,2);{
console.log(1,2)}

functionWithArgs(1,2);
  

function functionWithArgs(7,9);{
console.log(7,9)}

functionWithArgs(7,9);

Your browser information:

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

Challenge: Passing Values to Functions with Arguments

Link to the challenge:

your function needs to be reausable

a function when called is passed in some arguments:

whatILike("pasta");

when defined the function has some arguments, that are used inside the function

function whatILike (thing) { // "thing" is the function parameter
   console.log("I like " + thing + "!");
}

when this function is called as whatILike("pasta") you get I like pasta!
when the function is called as whatILike("cheese") you get I like cheese!

you need to make your function reusable in the same way, inside the function you need to use parameters

2 Likes