1. JS Six basic data types: string Boolean Number object undefined function
typeof returns a string of six kinds: string Boolean Number object undefined function
var a=1; if (function f () {}) { x+ =typeof F;} // value of x: "1undefined"
At this point function f () {} is not a functional declaration, it is converted to true, and internal f is undefined
2, instanceof
Instance a instanceof B (A is an instance of B), returns True, False
[] instanceof Array;//true
3 . Delete to remove the member variable of the object
(function(x) {delete x; Falsealert (x);}) (1)// results: 1
Because delete failed to delete X
4. js comma operator
var a= (All-in-one);//Final A has a value of 3, select the last value
5, JS pre-analysis
(function f () { function aaa () {return 1}; return aaa (); function aaa () {return 2};}) (); // The returned result is 2 because the code is pre-parsed before execution, and the following function declaration overrides the previous
6. Function parameters equivalent to local variables
var a=10; function aaa (a) {//A is equivalent to a copy of the global variable, which is a different parameter from the global variable A, a local variable a+=3;} aaa (a); alert (a);// At this point, we find the global a, basic type of copy operation, Global A has never been changed//10
var a=10;
function aaa () {
a+=3;//assignment operation, JS has no block-level scope, so changes the value of global variable A
}
AAA ();
alert (a);
13
JS face question (i.)