Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed JavaScript Quickstart!
You have completed JavaScript Quickstart!
Preview
You'll usually pass information to a function to change how the function works, using parameters.
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
you'll commonly pass information to a
function to change how the function works.
0:00
To do this,
0:01
you add what's called a parameter inside
the parentheses when creating a function.
0:01
So now let's change sayHello to a function
that accepts a custom greeting and
0:06
displays it to the user.
0:12
First, I'll change the function name to
0:13
sayGreeting to better to describe
the purpose of the function.
0:17
And this function will take one parameter,
I'll call it greeting.
0:20
Then I'll pass greeting into alert,
I'll simply copy and
0:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up