JavaScript learning summary [2], JS basics

1. JS Naming Standards Naming standards are very necessary to enhance the readability of the code. You can understand the meaning at a glance. Standards are to comply with the rules. Making the code conducive to later maintenance can also greatly improve development efficiency. A normal website has a lot of JS code. If you don’t follow certain rules during the writing process, you won’t be able to understand what you wrote later. This is a very troublesome thing, so you should write it in your usual time. During the practice, develop good coding habits. Generally, Hungarian nomenclature or camel case nomenclature is used. The principle of Hungarian nomenclature: variable name = attribute + type + object description. His key is: prefix with one or more lowercase letters, followed by one or more words with an initial capital letter, which specifies the purpose of the variable. The principle of camel case naming: the first word starts with a lowercase letter, and the first letter of each subsequent word is capitalized. For example: myFirstName, myLastName. Such variable names look like camels rising one after another, hence the name. The key to the camel case method is: except for the first word,…

js basics

js basic concept js local variables and global variables js Data type var is a weak data type, but js can recognize his data type About the method of js Writing of the method Method coverage Different from Java, there is no method overloading in js, only method coverage as long as the method names are the same. No matter how many parameters there are, js unity will only recognize the last method (method override) js data type conversion Although js only has one var to describe the variable (weak data type), the system can recognize his Data type, data type conversion can also be performed Operation calculation in js JS operation rules are the same as Java (but special attention: x=+y) function abc(){ var a=’#39;10′; var b='8'; console.log(“The value of b “+b+” The data type of b is converted to “+typeof(b)+” “+a) /* =+ first convert a to number and then copy the value of a to b */ /* += is equivalent to b+=a == b=b+a */ } Select statement and loop statement Short: same as java js main object window object time intervalr Array usage Basic operations on strings JS time formatting Recommended tutorial: “JS Tutorial” The…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索