JavaScript Ninja Cheats study notes (a)

Client web application life cycle stages

  • Page builder
    • Parse html code and build dom
    • JavaScript code execution
      • Global code and the function body
        • Different: different execution position, global function have JavaScript engine automatically executed in a direct way, the function code must be other code calls
  • Event Processing
    • The browser execution environment core idea : the same time, only one piece of code execution, single-threaded execution model
    • Event queue: realization browser needs a way to track the incurred but not yet processed.
    • The reason register event handlers: the occurrence of an event is not the order of the law, you must tell the browser before the event is processed which event we have to deal with
    • Two ways to register the event:
      • By the function to a particular attribute
        Example: window.load = function(){}
        But there are disadvantages, you can only sign up for an event.
      • By using the built-addEventListener
        Example: document.body.addEventListener("mousemove",function(){ console.log("mousemove"); })
        You can register multiple events to an element, more commonly

function

  • The difference between functions and objects: function is callable
  • How to determine an object is an object or function typeof abba === 'function'
  • The callback function meaning : in the implementation process, we have established will be a function of other functions at a later point the right time to come back call
  • The callback function uses:
    1. Storage function
    2. Since the memory function
  • Function immediately: Why is wrapped in brackets: Reason purely syntactic level, in order to function declarations converted into a function expression
  • Formal and actual parameters: ... arguments es6 parameter can be an expressionfunction(a,b=3)

Guess you like

Origin www.cnblogs.com/dadaochangcun/p/11829498.html