Passing Values and Functions with Arguments - What the actual heck!?

Ok, so I have input this code and reread and seen the video, seen multiple forums. I can’t figure out why I can’t pass.
Is there a glitch on the site? I click CTRL+ENTER and the website doesn’t react. I have tried restarting, trying on different browsers.
I can swear the code is correct. Unless I am absolutely stupid and haven’t understood this subject so far. Please judge for yourself:

function functionWithArgs(a,b) {
console.log(a + b);
}
functionWithArgs(1,2); //This should display 3//

function functionWithArgs(a,b) {
console.log(a + b);
}
functionWithArgs(7,9); // This should display 16 //

You cannot declare the same function twice.

1 Like

wow!

no further words needed.

I’m not sure if that’s a good or bad wow?

Does your code work now?

1 Like

It’s been years since I’ve used JavaScript, but why can’t you declare the same function twice? Shouldn’t it run the first declaration, output the result then run the next declaration with different inputs since it’s a scripting language?

A declaration isn’t the same thing as a function call. You can call a function as many times as you want.

Ooooohhh I see now, it’s been awhile. I totally missed he had two functions with the same name instead of just calling them twice with the different inputs. Thanks!

1 Like

that is what i thought, because the prompt says you need to declare the first set to result in a 3 and the second to result in 16. which is what i did… but once I read you “can’t” declare the same function twice. in a previous lesson we are taught, that you can simply re-call it and just add a new value and it will be replaced. So i simply removed the second section that resulted in the 16, and it passed. so who knows ?

its a great wow. I simply erased the second part of the code and it passed.

2 Likes

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