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 Functions!
You have completed JavaScript Functions!
Preview
There is another syntax for creating a function that is called a "function expression."
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
This is what's called
a function declaration.
0:00
There's another syntax for
0:01
creating a function,
that's called a function expression.
0:02
Open the file, expressions.js,
and in index.html,
0:05
update the source attribute in
the script tag to js/expressions.js.
0:10
A function expression lets you
assign a function to a variable.
0:17
For example,
0:21
you could rewrite the getRandomNumber
function to look like this.
0:22
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