Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Basics (Retired) Creating Reusable Code with Functions Giving Information to Functions

where do function arguments or parameters get their value from?

So... function needHelpWithParameters ( this stuff in here ) { Where does the value for the argument/parameter come from? }

Or do I create a variable with the value and store the value inside the function ( value here ) {}

Thanks for your time and advice!

1 Answer

Todd Anderson
Todd Anderson
4,260 Points


This was hard for me to figure out when I started. The parameters are what you will be modifying or using in your function/method.

It get passed in from outside sources. What you're doing when writing a function or method is setting requirements (parameters) that are needed to satisfy your function/methods call. Does that make sense?

public void newNum(int a){
      int a += 1;

Here my method newNum will take an integer passed in by either a user or from another aspect of my program and increase it by 1. I hope this helps.