1. Variables1.1 Duplicate statements and omissions of statements
The variable declared by Var is permanent, so deleting the variable with the delete operator will make an error;
Declaring a variable multiple times with VAR is not only legal, but it does not cause any errors. If a duplicate declared variable has an initial value, it is equivalent to assigning the variable a value;
If you attempt to assign a value to an undeclared variable, JS implicitly declares the object, and the implicitly declared variable is a global variable, although it is best to use VAR to create the global variable or the local variable;
1.2 Scope of variables (scope)
The scope of the global variable is global, and the scope of the local variable is local. Inside the function body, the local variable takes precedence over the global variable. If you define the parameter name of a local variable or function to be consistent with a global variable, the global variable will be effectively hidden;
JS does not have block-level scope;
1.3 Basic types and reference types
Base types: Numeric, Boolean, NULL, and undefined values;
Reference types: Arrays, objects, functions;
Base type, a number is 8 bytes in memory, and a Boolean is 1 bytes. However, unlike reference types, they are not fixed in length, so they cannot be directly present in eight-byte memory as the base type. Instead, the storage of a variable is a reference to the value, usually referred to as a pointer or memory address. Although the reference is not the data itself, but he will tell you where to find this value;
1.4 Useless storage units
The collection of useless storage units is automatic;
JS Learning Notes