How to reduce the number of demons by js
This article will explain in detail how js can reduce the number of demons. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Reduce the number of demons
For example, on line 800 of a file, a sentence pops up:
DialogHandler.showQuestionNaire ("seller", "sell", 5, true)
It will be very confusing, what do the above four constants represent? if I don't check the variable description of that function, I can't quickly realize the use of these constants. These unknown constants are called "magic numbers". So it's best to give these constants a name, especially in some of the more critical places. For example, the above code can be changed to:
Var naireType = "seller", dialogType = "sell", questionsCount = 5, reloadWindow = true; naireHandler.showNaire (naireType, dialogType, questionsCount, reloadWindow)
So the meaning is obvious.
This is the end of the article on "how to reduce the number of demons in js". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.