zoukankan      html  css  js  c++  java
  • arrow function、function.apply

    An arrow function expression has a shorter syntax than a function expression and does not have its own this, arguments, super, or new.target. These function expressions are best suited for non-method functions, and they cannot be used as constructors.

    Syntax

    Basic Syntax

    (param1, param2, …, paramN) => { statements } 
    (param1, param2, …, paramN) => expression
    // equivalent to: => { return expression; } 
    
    // Parentheses are optional when there's only one parameter name:
    (singleParam) => { statements }
    singleParam => { statements }
    
    // The parameter list for a function with no parameters should be written with a pair of parentheses.
    () => { statements }

    function.apply

    The apply() method calls a function with a given this value, and arguments provided as an array (or an array-like object).

    Note: While the syntax of this function is almost identical to that of call(), the fundamental difference is that call() accepts an argument list, while apply() accepts a single array of arguments.

    Syntax

    function.apply(thisArg, [argsArray])
  • 相关阅读:
    2020.02.22周末作业清单
    2020.2.21作业清单
    2020.2.20作业清单
    数学题目
    2020.2.19作业单
    Request对象
    HTTP协议
    http协议
    tomcate
    servlet-3-相关配置
  • 原文地址:https://www.cnblogs.com/lal520/p/9915174.html
Copyright © 2011-2022 走看看