In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
 
            
                     
                
2025-11-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to change stage-2". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to change stage-2.
Why is stage-2 hidden, because it is so low-key that you can ignore it, but in fact, it has a lot of meaning. In addition to covering all the functions of stage-3, it also supports plug-ins.
Stage-2 support plug-in
Syntax-trailing-function-commas
Transform-object-reset-spread
Syntax-trailing-function-commas
This plug-in makes people feel boring, and even makes people think that it is a little chicken rib. Because it is not an addition to the function of ES6, but to enhance the readability and modifiability of the code. As shown in the following code:
/ / suppose you have the following function, which takes two parameters
FunctionclownPuppiesEverywhere (
Param1
Param2
) {/ *. * /}
ClownPuppiesEverywhere (
'foo'
'bar'
)
/ / one day, it needs to be changed into three parameters, and you need to modify it like this
FunctionclownPuppiesEverywhere (
Param1
-param2
The line + param2,// needs a comma.
+ param3// add parameter param3
) {/ *. * /}
ClownPuppiesEverywhere (
'foo'
-'bar'
+ 'bar',// here is changed to a comma
+ 'baz'// adds new parameters
)
/ / see? We modified four lines of code. Ah, ah. Four lines of code have been modified.
How to change stage-2
Modified 4 lines of code, mm-hmm. The programmer who pursues high efficiency thinks that if there are more parameters in the future, do I have to wait for more lines? I have to think that the less the code changes, the better, so there are the following changes. no, no, no.
/ / Let's redefine the function.
FunctionclownPuppiesEverywhere (
Param1
Param2,//, notice here. We added a comma.
) {/ *. * /}
ClownPuppiesEverywhere (
'foo'
Bar',//, we also added a comma here.
)
/ / now that the function needs three parameters, let's modify it.
FunctionclownPuppiesEverywhere (
Param1
Param2
+ param3,// adds params3 parameter
) {/ *. * /}
ClownPuppiesEverywhere (
'foo'
'bar'
+ 'baz',// adds a third parameter
)
Thank you for your reading, the above is the content of "how to change stage-2", after the study of this article, I believe you have a deeper understanding of how to change stage-2, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about

The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r


A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from

Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





 
             
            About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.