Functions
In this lesson, we'll get to know JavaScript functions. Let's begin!
As you learned in the previous chapter, functions are very important concepts in JavaScript.
In this section, you’ll dive deeper into the implementation of functions and get acquainted with many exciting features that make JavaScript functions powerful.
Function return values
Functions may retrieve results.
- You can use the
return
statement to pass back a result. - If you specify
return
with no value, the function will immediately return without a value. - If you utilize the result of a function that does not return a value, be prepared that you could get
undefined
.
The Listing below demonstrates this behavior:
Listing: Using return
in various ways in a function
...Access this course and 1400+ top-rated courses and projects.