Problem:
What types of typeof can I get in 1.JS?
Test Center: JS Variable Type
2. When to use double equals = =? When to use the third-level = = =?
Test Center: Forced type conversion
The difference between 3.window.onload and domcontentloaded.
4. Use JS to create 10 <a> tags, click the time to bounce out the corresponding serial number.
Test Centers: Scopes
5. A brief description of how to implement a module loader to achieve basic functionality similar to Require.js.
Test Center: JS Modular
6. Implementing random ordering of arrays
Test Center: JS's basic algorithm.
1. Variables are divided into value types and reference types.
var a = 100;
var B = A;
A = 200;
Console.log (b); The print out is 100;
var a = {age:20};
var B = A;
B.age = 21;
Console.log (A.age); It's 21 printed.
Object array functions are reference types
typeof undefined//undefined;
typeof "AB"//string
typeof 123//number
typeof Ture//boolean
typeof can be distinguished for value types
typeof {}//object
typeof []//object
typeof null//object A null pointer does not point to any object
typeof Console.log//function
typeof distinguishes a value type but cannot differentiate between reference types, except for functions that are not distinguished, but that are objects of type object type, and that reference types can have unrestricted extended properties
2. Forcing type conversions
string concatenation = = (double equals) operator If statement logical operation is a type that can be coerced.
var a = 100 + 10;
Console.log (a); Type of
var b = 100 + "10";
Console.log (b); "10010" string type, because the + number, did a lightweight type conversion, the number into a string, and then connected together.
"//true";
0 = = ""//true; Empty string
Null = = undefined//true; Both null and undefined two can themselves be converted to false, so they can be equal.
JS Interview Basics