This is the fifth day of my participation in the August More text Challenge. For details, see: August More Text Challenge

With their own understanding, simple and comprehensive summary of basic knowledge, most of the content is the vernacular content, the foundation of the foundation to deepen understanding!

Consolidate the basic knowledge of learning JavaScript, deepen the understanding of memory, to build a firm foundation! Come on

For more detailed learning – it is recommended to view the MDN-javascript documentation, (Little Red Book/White Paper/Blue Book /..) Learn to advance!

Read more: Previous update review

Day1 (1)

[day2], [day3], [day4]

Preheat the text – Continue to comb through the knowledge

1, the foregoing – knowledge combing, deepen memory

  • Data types – Operators and expressions I ++ and ++ I
  • Select structure:
If (range condition) if(){}else{}, '===' conditional expressionCopy the code
Switch (fixed-value condition){case Constant expression: statement; break; }Copy the code
  • Circulation structure:

    • while
    • do … while
    • for( ; 😉 for … in
    • break continue

2. Function (key)

2.1 define

Function: a tool that implements code with a function through a function

2.2 Function definition:

  • A:

    • Function Function name (){} The naming convention of a function name is the same as that of a variable
    • Function call: function name (); A function call can be made before or after the function definition
  • Method 2: Expression definition:

    • Var function name = function(){}

    • Function call:

      • The function name (); A function call must come after the function definition

3, parameters,

    1. Formal parameters:
    • The parameter must be a variable
    • The parameter must appear in the definition of the function
    1. Actual parameters:
    • Arguments can be constants, variables, or expressions but must have values
    • Arguments must appear in the call to the function
    • Parameters and arguments are passed in one-to-one correspondence passing the value of the argument to the parameter
    • If the number of arguments is greater than the number of parameters, the excess arguments are automatically eliminated
    • If the number of parameters is greater than the number of arguments, the extra parameter defaults to undefined

4, function return value

A function can return a value via the return keyword

  • Return value does:

    • The user can directly display the return value of the function or manipulate the return value
    • If the function has a return value there is one and only one
    • A function that encounters a return does not execute any statement following the return
    • Return can only be used inside the body of a function

5, function argument copy (understand)

The arguments:

  • Arguments can only appear in the function body
  • Arguments is an object
  • Arguments is used to store all arguments
  • You can get the number of arguments using the length attribute
  • Arguments [0] indicates the maximum subscript of the first argument:argument.length-1

Fn. length Gets the number of parameters

function fn(a,b){
// alert( arguments.length );
// fn.length;
// alert(fn.length);
If( arguments.length ! = fn.length){alert(number of parameters and arguments inconsistent);return;// Block subsequent code execution.}
Copy the code

JS parser (extension);

There is a special place inside the browser to parse JS programs. This space is called the JS parser.

There are two steps to interpreting a JS program:

  • 1, preparse to find something, var function

    If we find var, we find a quantity, and we give that variable undefined in advance

    Finding a function means finding a function, and a value is given to the function name in advance, which is the function block itself

    Find two functions, and if they have the same name, the latter will override the previous

    If you find a variable with the same name as the function, keep the function

  • 2. Read the code line by line. If you encounter an expression that changes the value of a variable, the value of the variable in the repository will also change during the preparse

Come on, dreamers

Learning is a continuous process, stick to it, there will be harvest!

Accumulate over a long period of time, consolidate the foundation, early into dafang!

It is not easy to insist, adhere to a long time is not easy

Calm Down & Carry On!