In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the template of JS page". In the daily operation, I believe that many people have doubts about the template of JS page. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the question of "what is the template of JS page?" Next, please follow the editor to study!
The way it used to be-- I guess it's the way most people use it.
For example, the following code-a js code excerpted from Sina's home page-is also the way most people use it.
How did you react to the above code? You might change the form of + = to the push form of an array. Some people say that push is faster than this kind of character link, but not much faster.
If there is a lot of embedded html code, do you want to do the same? If you modify (add or delete) a html, you have to keep going through the code, looking for the corresponding tag, and then looking for the closing tag, don't you find it troublesome? Maybe someone will write this (this is what I wrote earlier, and it is the way I am most used to using it).
The above code is also very difficult for me to maintain. Very often, if I add a tag on the ui side, or modify the html structure, then I will have a headache.
Page templating-- A new way
I recently read the js code of facebook and happened to find that the following ways look good, which I would like to share with you.
Look at my index.html code.
Look at my js code.
Today, I happened to find that this approach is more reasonable, because the for loop looks so annoying.
It is easy for us to maintain the above html code, and it will be easy to change it next time regardless of any change in the structure of the html code.
Late repair
Yesterday I needed conditional filtering in my project, so I did another if syntax parsing function.
Highlight the code:
Correspondence method
At this point, the study of "what are the templates of JS pages" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.