Function usage in JavaScript


4) Function usage

Example 3.4.1


    /*When the Global object is created, it always has at least the following properties:
       Object object
       Function object
       Array object
       String object
       Boolean object
       Number object
       Date object
       Math object
       Value properties

    /*The advantage of function is that the function body can be an incoming dynamic string at runtime, for the function class, the last parameter is
function body, while the parameters before the last one are input arguments.,’x ‘can be changed to “X” * /
var a =’return x + y;’;
var f = new function (‘x ‘,’ y ‘, a); / / equivalent to var f= function(x, y){return x + y;}
    document.write (f(1, 1));

Reprinted from: 44594249/article/details/100015900