In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of javascript how to jump out of the function, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value, I believe you will gain something after reading this javascript how to jump out of the function article, let's take a look at it.
Javascript can jump out of the function and can be implemented using the return keyword. Whenever JavaScript sees the return keyword, it immediately exits the function, and any variables (or values) passed after return are returned as a result.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
Sometimes when you are executing a function, you want to have a quick exit (pop-out) method.
You can use the return keyword to do this.
Whenever JavaScript sees the return keyword, it immediately exits the function, and any variables (or values) passed after return are returned as a result.
This is a method I often use to ensure that I exit a function immediately when some conditions are different from what I expected.
Maybe I expect a parameter, but it's not there.
Function calculateSomething (param) {if (! param) {return} / / go on with the function}
If the param value exists, the function will proceed as expected, otherwise it will stop immediately.
In this example, I return an object that describes the error.
Function calculateSomething (param) {if (! param) {return {error: true, message: 'Parameter needed'}} / / go on with the function} on "how to jump out of the function" this article is introduced here, thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to jump out of the function of javascript". If you want to learn more knowledge, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.