Web front-end interview summary --JavaScript

JavaScript

1.JavaScript built-in objects What?

  • Math
  • Date
  • Function
  • Array
  • String
  • Number
  • Boolean
  • Object

2.JavaScript built-in objects Array, String what ways (more than 15)?

  • Array
push () // one or more data is added to the end of the array, and returns the new length of the array. 
POP () // remove the last item in the array, the length property modification, and returns the data to be deleted 
shift () // take the first element in the array, the length property modifying 
the unshift () // prepend item in the array, return the array length 

Reverse () // array flip 
Sort () // Sort the array is even, and is based on the character , from small to large order 
// sort with parameters is how to achieve? 

concat () // splicing parameters to the current array 
slice () // current array taken from a new array, does not affect the original array, parameter start from zero, end starting from 1 
splice (start position, the number deleteCount the new element options ...) // remove or replace the current array of some items, parameters start, deleteCount, options (item to be replaced) 
// meaning of the above method is to remove from the position from the start deleteCount elements, with Alternatively new element option (option new elements can have many). 
All the elements join () // array method at a given string "series" is a string format. 

indexOf (), lastIndexOf () // find the character subscript, if not found returns -1 

Every (), filter (), forEach (), the Map (), some ()
  • String
Method 1 // character 
the charAt () // Get the specified character position 
the charCodeAt () // Get the specified position in the ASCII 

// string manipulation method 2 
the concat () // string concatenation, equivalent to +, + more usually 
slice (start, end) // starting from start position, end position to intercept, fail to end 
substring (start, end) // starting from start position, end position taken to end the reach 
substr (start, length ) // start position from the beginning, the interception length character 

// method 3 position of 
the indexOf () // returns the specified content in the meta position of the string, the method may set two parameters, .indexOf ( 'string looking for ', from a position p), represents the start looking from a position p particular character string, if found, return to find the location, otherwise -1;. If the second parameter is omitted, started looking from position 0 
lastIndexOf () // looking forward from the rear, only to find a match for the first 

// blank 4 is removed    
TRIM () // only before and after removal of the blank string (including spaces, carriage returns, line feeds, tab character) 

/ / 5 converting method sensitive 
to (Locale) upperCase () // converts uppercase 
to (Locale) lowerCase () // converts lowercase 
 
// other 6
search () // group Is equivalent to the match, it returns the value of the first matching position. If no match is found, or -1 
replace () // for replacement substring matching, generally to replace only the first match, it returns the new string 
split () // with the specified character string segmentation an array

3.JavaScript data types are there?

4. Analyzing the data type of the variable way?

The difference 5.null and undefined?

6.js common Dom operations API?

7. event bubbling and event capture?

8 ways to stop the event bubbling?

9. understanding of the closures, when constitutes closure? Closed implementation package? Advantages and disadvantages of closing package?

10.this usage scenarios and pointing?

  • Arrow function: parent point this
  • Timer: pointed window
  • Normal function:
  • Examples of object:

11. A method of modifying this point? What is the difference between the three?

  call、apply、bind

The role of 12.new keywords?

13. explain prototype chain?

14. Create an object of way?

15. The inheritance way? The advantages and disadvantages?

16. understand js variable lift?

The difference between 17 and == ==='s? After the comparison == cast is how to achieve?

18. redraw and return?

19. compiled languages ​​and interpreted languages?

  The computer can not directly understand any language other than the language of the machine, so the programmer must take written language into machine language programs, the computer can execute the program. Other languages ​​will be translated into machine language tool, known as a compiler.

  There are two ways compiler translation: one is compiled, the other is the explanation. The difference between the two ways that different points of time translation. When the compiler runs to explain the way, also known as interpreter.

  • Compiled language: the program before execution requires a special compilation process, the program files compiled into machine language translation does not need to re-run, the direct result of using the compiler on the line. High efficiency of program execution, depending on the compiler, cross-platform hearing. Such as C, C ++
  • Interpreted language: programs written in interpreted languages are not pre-compiled, stored as text code, the code will run directly sentence by sentence. When publish a program that looks saving road compile process, but when running the program, you must first explain the run, such as JavaScript

  Compiled language with the interpreted language comparison:

  • Speed - faster than a compiled language interpreted language execution speed
  • Cross-platform  - cross-platform interpreted language than compiled languages well

20. The task of macro, micro tasks, task queue and scheduling?

21. Scope?

  • Global scope:
  • The local scope:?
  • Block-level scope:?

Guess you like

Origin www.cnblogs.com/belongs-to-qinghua/p/11033112.html