From the course: Learning the JavaScript Language
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Basic functions - JavaScript Tutorial
From the course: Learning the JavaScript Language
Basic functions
- [Instructor] In this video, we're going to begin looking at functions, which are a way of packaging up lines of code in one unit that you can name, invoke, and maintain separately. We've been dancing around the idea of functions a bit in this course. It's kind of difficult to talk about anything in JavaScript that's meaningful without touching on functions on some level. So I'm glad we're getting to it properly now. Anytime I've talked about methods that are part of objects, those have been functions. And now it's time to talk about making our own. We're going to start out with these four lines of code. Just four lines of logging messages to the console with animal noises, not rocket science, but just bear with me. I'm going to grab these out of the file, copy them, and I'm going to open a browser tab, and open up a JavaScript console. If I'm going to print these animal noises repeatedly, it's easy enough. I can…
Contents
-
-
-
-
-
-
-
-
(Locked)
Basic functions4m 20s
-
(Locked)
Arguments and parameters in functions6m 54s
-
(Locked)
More on function arguments5m 3s
-
(Locked)
Objects, references, and functions7m 4s
-
(Locked)
Functions are objects5m 8s
-
(Locked)
Jargon: Scope in JavaScript2m 30s
-
(Locked)
Functions and scope5m 11s
-
(Locked)
Writing shorter functions with arrows3m 12s
-
(Locked)
Three little dots collect the rest4m 14s
-
(Locked)
Callback functions and looping4m 34s
-
(Locked)
-
-