• 函数:函数是可以被调用对象,
    • 怎么被调用的?


函数的arguments和this的确认流程:
  • a



function:
In JavaScript every function is actually a Function object.

In JavaScript, functions are first-class objects, because they can have properties and methods just like any other object. What distinguishes them from other objects is that functions can be called. In brief, they are Function objects.



function constructor/declaration/function expression
  • funtion constructor
    • The Function constructor creates a new Function object.
      • var adder  =  new Function('a', 'b', 'return a + b');
    • Functions created with the Function constructor do not create closures to their creation contexts;
      • they always are created in the global scope
  • function expression
    • var square = function(number) { return number * number };

function definition (also called a function declaration, or function statement) :
  • function foo(xx){}



2. 所以函数也有属性和方法。
  • 每个函数都包括length和prototype属性


所有的内置对象继承于Function对象。

问题:
  • 为什么Function.__proto__为函数?

1.函数对象、函数的调用

2019-02-16 21:56:07 0 5
这里是评论

相关推荐