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
A function is a collection of code that performs a task or calculates a value.
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
So for example, prompt and alert
0:00
are built in JavaScript functions you can
use over and over again in your program.
0:00
JavaScript also lets you
define your own functions.
0:04
To create a function,
you type the keyword function
0:07
followed by the name you want to give
the function, for example, myFunction.
0:11
Then a set of parentheses and
a set of curly braces.
0:16
In a function,
the Java script you place inside
0:20
the curly braces is run whenever
the function is activated.
0:23
Think of the code inside the braces as
a set of instructions that you want to run
0:27
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