I need some more clarity on Functions please


One doubt! Does a "Function" always comes with a "Variable"?

Why we declare a "Function" as a value for a "Variable"? And then a value (parameter) for the "function"?

We can just declare value straight to a "variable" and can call back it wherever we want right?

I need some more understanding on structure of "Functions" please!

Replace this line with your code.


Okay that can be really confusing, you're right. But there actually is another way of declaring functions. What I use more often, (and they will teach you eventually), is that you can just write the word function, then write the name of the function, then introduce your parameters. Parameters are not super complicated, but it's sort of like math and f(x) functions (if you've done algebra), but basically, it's for calling the function. Functions can do pretty much anything. Calling a function is to make it work, but when you call the function, you put in parameters so that the function does something based on your input.

What I suggest is going to stackoverflow.com, typing in JavaScript, and then typing in what you don't understand, (functions, function notation, parameters, etc.)
What I included above is about the two types of notation for defining a function. :slight_smile:

Discussion about better understanding of function

@kyleaw, very good explanation! :+1: :+1: :+1:

I need some more understanding on structure of "Functions" please!

If you want to know smth more, always read doc:
1. MDN Functions. For the first time may seem very difficult, so look to Defining functions and Function parameters sections :

One of the benefit of creating a named function expression is that in case we encounted an error, the stack trace will contain the name of the function, making it easier to find the origin of the error.

  1. There you can read about this keyword. It's very important when you are using functions with methods or as an object constructor.
  2. If you need to try some examples you can use w3schools.com. In your case: JavaScript Functions - W3Schools.

And after that, if you can't understand smth, you can always ask Codecademy community and we will help you.


Thank you! Pretty nice yourself!


Thank you very much!..:slight_smile:


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