From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext
Unlock this course with a free trial
Join today to access over 25,000 courses taught by industry experts.
Write functions using arrow syntax - JavaScript Tutorial
From the course: Learn JavaScript: Write Modern Code with JavaScript ESNext
Write functions using arrow syntax
- Earlier in the course, we learned about functions in JavaScript and the basic syntax for defining them. As you'll see in the next few topics, one of the major areas where the latest ES6 syntax really shines through is that it greatly simplifies a lot of the most common code that we write on a day-to-day basis. This means that the operations that used to take a lot of characters, or even several separate statements in earlier versions of JavaScript, can be done much more easily with the new syntax that ES6+ provides. So prior to ES6, the main way to define functions was by using the function keyword, and you really couldn't define functions without it. In programs with a lot of functions, however, such as software written in a functional programming paradigm, this became a bit of a pain. Even though function is only eight letters, it does add up over time. So ES6 came along with a much more simplistic way of defining functions, and that's by using something called the arrow function…
Contents
-
-
-
-
-
-
-
-
(Locked)
Learning objectives1m 45s
-
(Locked)
Write functions using arrow syntax4m 22s
-
Set default values for function arguments3m 32s
-
(Locked)
Learn about the spread operator4m 11s
-
(Locked)
Use object destructuring to get object properties3m 53s
-
(Locked)
Use interpolation to insert data into strings1m 44s
-
(Locked)
Learn the import and export code in JavaScript6m 19s
-
(Locked)
-
-
-
-
-
-