zoukankan      html  css  js  c++  java
  • javascript中的Function对象

    1、Function.length:返回函数的形参个数,注意:带有默认值的参数以及rest参数不计算在内。

      arguments.length:函数被调用时实参的个数。

      Function 构造器本身也是个Function。他的 length 属性值为 1。

      Function 原型对象的 length 属性值为 0 。

    2、Function.prototype:Function的原型对象;

    3、Function.prototype.toString():返回当前函数源代码的字符串;

    4、Function.prototype.apply():fun.apply(thisArg[, argArray])

     参数:thisArg:A、fun运行时的this指向;

              B、非严格模式下,如果thisArg为null或者undefined,则this指向全局对象  window;

              C、如果thisArg为原始值,则this指向原始值的自动包装对象。

        argArray:数组或者类数组对象,为fun调用时的参数。

      Function.prototype.call():fun.call(thisArg[, arg1[, arg2[, ...]]])

    两者区别:call接收一个参数列表,apply接收一个含多个参数的数组或者类数组。

    5、Function.prototype.bind():详情见另一文章(http://www.cnblogs.com/ilovexiaoming/p/6899238.html)

  • 相关阅读:
    分页实现
    jquery扩展提示框
    可拖拽可扩展面板
    单表查询结果转换成泛型集合
    压缩远程图片并返回
    windows下python安装架包的问题
    从网络上下载数据
    自己实现jquery
    如何利用拼音首字母查询数据库
    正则表达式
  • 原文地址:https://www.cnblogs.com/ilovexiaoming/p/6879855.html
Copyright © 2011-2022 走看看