Java Script and Algorithyms- Basic Structures Write Reusable JavaScript with Functions

From my understanding the name of the function is function name. Why do we put the () after function name?

  **Your code so far**

function functioname() {
console.log("Hi World");
  **Your browser information:**

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

Challenge: Write Reusable JavaScript with Functions

Link to the challenge:

Hi @sameerauf1, as you’ll probably see in the coming lessons, those parenthesis will hold the “input” that the function consume.

Even without inputs, like in this case, the parenthesis are mandatory as part of the Syntax rules.

Hope it helps.


Hi Marmiz,

Oh does that mean, if you give the computer a certain input, it will run that function and give you an output?
Best Samee,

Thank you!

yes, you give an input to the function when you call it

the round parenthesis here are the place to put the placeholders for the function inputs
you will learn about function parameters going forward

1 Like

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