Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Creating Reusable Code with Functions Review Creating Reusable Code with Functions

Hui Zheng
PLUS
Hui Zheng
Courses Plus Student 1,380 Points

Example with functions

I had recently finished watching a video on the topic of functions. The example that was given in the video generated a series of small circles in different colors. I was looking for that video from the tracks I had completed, but I was not able to find it there. I do want to go back to that video since I had a question I wanted to ask regarding the example in that video. I remember the instructor passed in the word message as a parameter to a function that was called to print out the html strings. But I didn't quite understand why the word message was passed in as a parameter, i had only seen numbers or variable that stored numbers(var upper = 10000;) were passed in as parameters in other previous examples

1 Answer

Is this the video?

Hui Zheng
Hui Zheng
Courses Plus Student 1,380 Points

Yes, that was the one professor. By the way why was the word message passed in as a parameter in one of the functions. I know the function was used to print the values, but I had never seen a word been passed in as a parameter in the previous examples. I had seen numeric values been passed in to be used in a formula or variables that stored numeric values got passed in as parameters. Is message a keyword that is specifically used in this particular function? Thanks