3-- interview summary -es6

es6 document: http://es6.ruanyifeng.com/
1, es6 new features
  • let/const
  • Deconstruction variable assignment (assignment deconstruction array, destructuring assignment destructuring assignment, assignment function parameters deconstruction object, destructuring assignment string, numeric, and boolean)
    • Note: Parentheses problem
      destructuring assignment though very convenient, but it is not easy to resolve. For the compiler, a formula in the end is a pattern, or expression, there is no way to know from the outset, we must resolve to (or not resolve) the equal sign in order to know
      the situation can not use parentheses:   
      • Variable declaration statement
        eg:  let [(a)] = [1];  //报错
      • Function Arguments
        eg:  function f([(z)]) { return z; } // 报错
      • Assignment mode statements
        eg:  ({ p: a }) = { p: 42 };
  • Template string
  • An array of related
    • map
    • set () which is similar to an array, but the value of the member is unique, no duplicate values.
  • String associated
           str means the search string ,, index indicates the position to begin the search
    • startWith (str, index) returns a Boolean value indicating whether the parameter string at the head of the original string eg: let s = "! Hello word" s.startWith ( 'Hello') // true
    • endsWith (str, index) returns a Boolean value indicating whether the parameter string at the end of the original string eg: ( '!') let s = "! Hello word" s.startWith // true 
    • includes (str, index) returns a Boolean value indicating whether the parameter string found eg: "! Hello word" let s = s.includes ( 'o') // true
    • REPEAT (N) represents the original string repeated N times (if the transmission parameter is a decimal will be rounded, if the parameter passing is being given negative or Infiniti)
    • padSrart (length, str) If a specified length is not enough, will complement the head.
    • padEnd (length, str) tail completion
    • trimStart()
    • trimend ()
    • Returns a regular expression matchAll () trans method string matches all current
  • Symbal new data type represent a unique value. It is the seventh data types JavaScript language, the first six are: undefined, , nullBoolean (Boolean), string (String), value (Number), objects (Object).
    • ... Expand operator / remaining operations
    • Related functions
      • Arrow function
      • Function parameter default values
      • The name attribute
    • Class / inheritance 
    • proxy
    • promise
    • async
      <script src="path/to/myModule.js" defer></script>
      <script src="path/to/myModule.js" async></script>
      The above code, <script>the label opened deferor asyncproperty, the script is loaded asynchronously. Rendering engine encounters this command line, it will start downloading external scripts, but will not wait for it to download and execute, but subsequent commands executed directly.
      deferThe asyncdifference is: deferto wait until the entire page in memory, rendering normal end (DOM structure is completely generated, as well as other script execution is complete) will be performed; asyncOnce downloaded, the rendering engine will break rendering, after implementation of the script, and then continue rendering.
      In short, defera "complete re-rendering execution" asyncis "downloaded on the implementation."
      In addition, if there are multiple deferscripts, will appear in order of pages loaded in accordance with them, and more asyncscripts can not guarantee load order.
    • module syntax
      • export
      • import

Guess you like

Origin www.cnblogs.com/janice-jia/p/11789746.html