10 most common Javascript mistakes and how to avoid them

Learning link: http://www.iteye.com/news/32887 In

summary,
1. Different browsers will have different prompts for the same error.
2. Define variables before using them, including object attributes and arrays. In this way, no error will be reported when object.property arr.length
3. The function must be defined before the function is called.
4. Before loading js, make sure that all dom elements have been loaded. If the dom needs to be manipulated in js, an error will be reported. null error because there is no such dom element

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326103838&siteId=291194637