2021-02-26js learning-arguement, function, scope chain, js code execution process, object creation, new execution process.

problem:

  1. What is the concept of Agurement?
  2. What is the concept of pseudo-array?
  3. Two ways to declare functions?
  4. Are the variables used directly without declaration in the function global variables?
  5. Js block-level scope understanding?
  6. What is the concept of scope chain?
  7. What are the two steps for Js engine to execute code?
  8. Var a = b = c = 9; Are all three variables a, b, and c declared in this statement? What representation can be used to replace it?
  9. There are three ways to create objects? How will they operate?
  10. New keyword execution process?

Reply:

  1. What is the concept of Agurement?
    a) It is a built-in object of a function, used to store the incoming actual parameter data. It uses a pseudo-array storage method.
    b) Applicability, when the number of incoming actual parameters is too much case
    c) use: like an array, but the array can not use methods such as pop () method
  2. What is the concept of pseudo-array?
    a) It means that the data storage of the object is in the form of an array, and the only difference is that some data in the array cannot be used.
  3. Two ways to declare
    a function ? a) Function function name (parameter)();
    b) Var function name = function()(); Anonymous function declaration.
  4. Is the variable used directly without declaration in the function a global variable?
    a) Yes. It is a bug in javascript
  5. What is the understanding of Js block-level scope?
    a) In the past, js did not have block-level scope, which means var,
    b) Add block-level scope after Es6, which means let, const.
    c) It is recommended to use let and const in the future . java integration.
  6. What is the concept of scope chain?
    a) When the internal function accesses the external function, the variable is a way to determine the variable when the variable name is repeated.b
    ) The chain search is used to find the main
    method.c) The cause It also uses var to declare variables, and var has no block-level scope.
  7. What are the two steps for the Js engine to execute code?
    a) Pre-parse, execute
    b) Pre-parse: advance the var and function declarations in js to the front of the current scope, not including let
    c) Execution: follow the code order from the top Go down and execute the code.
  8. Var a = b = c = 9; Are all three variables a, b, and c declared in this statement? What representation can be replaced?
    a) No, only a is declared
    b) is equivalent to var a ; a= 9; b=9; c=9;
  9. There are three ways to create objects? How do they operate?
    a) Literals,
    b) Create Object objects first, then add attributes and squares
    c) Use construction methods to create objects.
    d) Use literals for a separate object Create, for multiple repeated objects, use the constructor to create the object.
  10. New keyword execution process?
    a) Create a new empty object in memory
    b) Let this point to this new object
    c) Execute the code in the constructor, add properties and methods
    to this new object d) Return this new object,

Guess you like

Origin blog.csdn.net/weixin_44767679/article/details/114120247
Recommended