What are the considerations for the use of return statements
This article mainly explains "what are the matters needing attention in the use of return sentences". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "what are the points for attention in the use of return statements?"
Precautions in using return statement
JavaScript ends automatically on the last line of code by default.
The following two instances return the same result (one with a semicolon and one without):
Example 1
Function myFunction (a) {
Var power = 10
Return a * power
}
Example 2
Function myFunction (a) {
Var power = 10
Return a * power
}
JavaScript can also use multiple lines to end a statement.
The following example returns the same result:
Example 3
Function myFunction (a) {
Var
Power = 10
Return a * power
}
However, the following instance result returns undefined:
Example 4
Function myFunction (a) {
Var
Power = 10
Return
A * power
}
At this point, I believe you have a deeper understanding of "what matters needing attention in the use of return statements". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!