JS Advanced Programming notes

  1. third chapter

    1. parameter

      1. ES parameters within the array is represented by a

        1. Array contains parameters which are not concerned

        2. This in vivo function can be accessed by a parameter array objects arguments (Array instance is not so)

        3. function doAdd(num1, num2) {
              arguments[1] = 10;
              alert(arguments[0] + num2);
          }
          
          doAdd(10);    // NaN
          doAdd(40, 50)    // 50
          1. 50 ---- arguments corresponding to the value of the named parameter values ​​to synchronize

          2. NaN

            1. Arguments object length is determined by the number of passed parameters (argument) is not determined by the number of parameter

            2. No value is passed to the named parameter values ​​are given undefined

          3. The ES values ​​for all parameters are passed, can not be passed by reference
      2. Overload

        1. Overloading: a function to write two definitions, as long as the two defined signature (parameter type and quantity) can be different.

        2. ES, there is no overloading. After defining the function defined in a front cover
  2. Variable domain and Memory

    1. Basic types of value type and reference

      1. The basic type of value is based on the value of access, reference type of access by reference

        1. Values ​​of reference types are object stored in memory. JS memory space does not allow direct manipulation of objects.

        2. So when the operation object, operation is referenced object. When you copy holds a variable object, the operation is a reference to the object; when you add a property to the object, the operation is the actual object. . . .

      2. Dynamic properties, static basic types

        1. You can add properties to the object, but you can not add attributes to the basic types
      3. Copy the value of the variable

        1. Variable object

          1. Variable object is a special object related to the execution environment, the context in stores the following statement:

            • Variable (var, variable declarations)

            • Function declarations

            • Function Parameters

        2. Copy basic types

          1. var num1 = 5;
            var num2 = num1;
          2. Pointer few bytes representing the address bus depends on the width of the system 32 is four bytes, so it is int char type or other type or type, are four bytes.
    2. Scope and execution environment

Guess you like

Origin www.cnblogs.com/wydumn/p/11575470.html