FAQ: Functions - Functions for Organization

This community-built FAQ covers the “Functions for organization” exercise from the lesson “Functions”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn How To Code

FAQs on the exercise Functions for organization

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

During the “4/6, Functions for organization” exercise, I arrived at the last “I’d like 3 sandwiches, 2 fries, and 2 triple ice cream scoop, please!”… When making the fries without functions, I actually accidently added an extra fry. A simple mistake I really didn’t think would happen, but knew WITH the functions button, my error would not have occurred. Thank you for this basic and valuable lesson on functions.

1 Like

Aspiring coder here. Just trying to string together what I’ve learnt. Would anyone mind telling what the difference is between a function and variable? Thank you in advance.

They are really quite different from one another. A variable is a label to which we can assign any object, which in JavaScript includes anonymous functions, since they too are objects.

A function is an isolated block of code that we can call upon repeatedly anytime during the run session. Some functions perform heavy lifting and others perform relatively simple utility tasks.

foo = function (parameter) {
    // code body
    return expression or value
}

Above, foo is the variable to which we have assigned an anonymous function expression. We can execute (call) the function by referring to its variable name…

console.log(foo(argument))

Variables are not objects, per se. They refer to objects so that we can access them either to poll (get their data) or update (modify their data).

We learn more about functions as we move forward, but variables once we understand them to be simply labels, won’t require much review or practice. They are used all the time so one gets quite used to them.

That’s really helped to clear the confusion. Thank you for taking the time.

1 Like