码迷,mamicode.com
首页 > 其他好文 > 详细

es7 函数绑定

时间:2017-05-03 23:56:21      阅读:298      评论:0      收藏:0      [点我收藏+]

标签:turn   eth   obj   bsp   func   bind   运算   bar   apply   

函数绑定运算符是并排的双冒号::

foo::bar
== 
bar.bind(foo);

foo::bar(...arguments);
==
bar.apply(foo, arguments);
var method = ::obj.foo
//==
var method = obj.foo.bind(obj)

 尾调用

function f(x){
  if(x > 0){
    return m(x);
  }
  return n(x);
}

 

es7 函数绑定

标签:turn   eth   obj   bsp   func   bind   运算   bar   apply   

原文地址:http://www.cnblogs.com/xudy/p/6804477.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!