1.JavaScript is case sensitive;
2. If you don’t write var when declaring a variable, you have declared a global variable; any function that is not a method is a global variable, and this inside it points to the window;
3.% operator, find the remainder, keep the integer, y=5;x=y%2; then x=1;
4. If you need to connect two or more string variables, please use the + operator, which is different from PHP;
5.Ternary operation: greeting=(visitor==”PRES”)?”Dear President “:”Dear “;
6.indexOf() method, counting from 0, spaces also count as one digit;
7.Math.floor() rounds down the integer, and the returned value is less than or equal to the number, Math.floor(-5.9), returns -6;
8. When declaring variables inside a function, be sure to use the var command. If you don't use it, you are actually declaring a global variable!
9. When writing a demo, be sure to write JS to the bottom to prevent the JS code from running as expected due to the html element not being loaded (JS is an interpreted language, which is interpreted while loading, and only the target object is loaded into the DOM. The tree can only be obtained and manipulated later);
10. The meaning of closure: Closure is actually a nesting of functions. The inner function can use all the variables of the outer function, even if the outer function has been executed (so closures will have performance problems, and the outer variables are outside It still exists in the memory after the layer function call is completed);
11. The value of the checkbox is checked, not true; the value of canceled is undefined, not false;
12. To determine whether a variable is undefined, use typeof(flag)===”undefined”;
13. Global variables can be accessed inside JS functions (or used as external variables of functions), which is different from PHP;
14. This in a function always points to the caller, or you can say this: for functions that are not methods, this points to the window; for functions that are methods, this points to the object itself (pay attention to the closure issue in the method, this points to the window of);
15. Methods to destroy variables: obj = null; delete obj;
16. When judging directly, the following will be converted to false: undefined, null, 0,-0, NaN, "" (empty string); all other values, including objects and arrays, will be converted to true;
17. The Boolean value contains a toString() method that can return a true or false string;
18. It can be said that JavaScript has only 6 data types, numbers, strings, Boolean values, null, undefined and objects;
19. There is no block-level scope in JavaScript, instead it is function scope (see P57 of Rhinoceros Book Sixth Edition);
20. JavaScript’s declaration advance feature: all variables declared in a function are advanced to the top of the function (see Rhinoceros Book Sixth Edition P58);
21. The execution of functions in JS is asynchronous, so pay attention to the value issue.