From the course: Learning the JavaScript Language
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Writing shorter functions with arrows - JavaScript Tutorial
From the course: Learning the JavaScript Language
Writing shorter functions with arrows
- [Instructor] Writing functions doesn't take a ton of keystrokes, but in this video we'll explore arrow functions, which are part of ECMAScript 2015 that allow functions to be defined with fewer keystrokes. JavaScript is very function-oriented. Indeed, you can use it in a formally functional way, which pretty much means everything would be done via functions. As a result, being able to define a function with less typing is pretty handy. Let's look at this speech function that prints a few animal noises. This is written as a function expression assigned to a constant called speak. This is just like what we've seen previously. We have our function keyword. It's unnamed because we're assigning it to this variable and then we have our curly braces with the things we want it to do. With an arrow function, we can save even having to type that word function. We just leave it off. But in order for this to be recognized as a…
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)
-
-