Home  >  Article  >  Web Front-end  >  Sharing experience using js_javascript skills

Sharing experience using js_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:20:411140browse

I haven’t been learning JavaScript for a long time. So far, I have the following 5 points of experience, which will be updated slowly in the future.

1. Assigning values ​​to undeclared variables will cause a ReferenceError to be thrown in strict mode (meaning, all variables must be defined with var, and global variables cannot be defined inside a function);

2. In strict mode, variables named eval and arguments cannot be defined, otherwise it will cause syntax errors;

3. Determining whether a variable value is equal to undefined is to formally distinguish between null object pointers and uninitialized variables;

4. As long as the variable intended to save the object has not actually saved the object, the object should be explicitly allowed to save the null value. This not only reflects the convention of null as an object pointer, but also helps to further distinguish null and undefined;

5. Octal literals are invalid in strict mode and will cause the supported Javascript engine to throw an error;

In fact, learning JavaScript requires learning more, practicing more, and using it more. Practice makes perfect. The ancients never deceived me! ~~

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn