zoukankan      html  css  js  c++  java
  • 【01】用构造器创建函数中的小知识

    【01】用构造器创建函数中的小知识
     
     
    魔芋:在看ES5.1标准文档时。
    Function (p1, p2, … , pn, body)
     

    NOTE It is permissible but not necessary to have one argument for each formal parameter to be specified. For example, all three of the following expressions produce the same result:

    (为每个形参指定一个参数是允许的,但没必要。例如以下三个表达式产生相同的结果:)

    new Function("a", "b", "c", "return a+b+c") 

    new Function("a, b, c", "return a+b+c") 

    new Function("a,b", "c", "return a+b+c")

     
    魔芋:例子:
    var funa = new Function("a", "b", "c", "return a+b+c");
    var funb = new Function("a, b, c", "return a+b+c");
    var func = new Function("a,b", "c", "return a+b+c");
    
    console.log(funa(1, 2, 3), funb(1, 2, 3), func(1, 2, 3));
    
     
    var a= "moyu";
    var funa = new Function(a, "b", "c", "return a+b+c");
    /* function funa(moyu,b,c){
    
    	return a+b+c;
    }
    */
    var funb = new Function("a, b, c", "return a+b+c");
    var func = new Function("a,b", "c", "return a+b+c");
    
    console.log(funa(1, 2, 3), funb(1, 2, 3), func(1, 2, 3));
    
     
     

    **

  • 相关阅读:
    STA分析(四) lib model
    STA分析(三) cmos模型
    STA分析(二) multi_cycle and false
    STA分析(一) setup and hold
    UVM环境(一)
    Perl中的正则表达式(五)
    RVDS编译器
    ARM的Trust Zone技术
    001-shell基础,创建,运行
    006-mac下finder操作
  • 原文地址:https://www.cnblogs.com/moyuling/p/8527942.html
Copyright © 2011-2022 走看看