JavaScript little detail summary

Var with the difference 1.let

The scope is let block, var is a function of the scope of

2. Variable

Variable names consist of letters, numbers, underscores and $ symbols

3. Constant

Name all caps

4. naming

Categories: the first letter capitalized

Function names and variable names: lowercase first letter, written Camel

The basic types of

String ( '' or ''), numeric, boolean

6.null与underfined

null: has been defined, the variable is null

underfined: declared, not initialized

7. prevent bubbling, the default behavior

Prevent bubbling: event.stopPropagation ();

Prevent the default behavior: event.preventDefault ();

Uniform abbreviated as: return false

8. page response

9. Obtain node tag

document.getElementById (id); // Get node id tag

document.getElementByClassName (className) // Get node label className

document.getElementByTagName (tag) // Gets the label of nodes by tag name tag

Guess you like

Origin www.cnblogs.com/-ting/p/11665165.html