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

箭头函数=>

时间:2019-08-27 22:42:42      阅读:62      评论:0      收藏:0      [点我收藏+]

标签:this   htm   UNC   inner   fun   bsp   html   实例   class   

   我第一次接触到箭头函数=>的使用是在rxjs的教程中,当时这个用法看得我糊里糊涂。

  箭头函数的两个好处:简化书写、不会绑定this。

  看一下箭头函数的使用实例:

let plusOne = (i, j) => i + j; 
document.body.innerHTML
= plusOne(5, 4);

  以上代码等价于:

  

let plusOne = function(i) {
    return i + 1;
}
document.body.innerHTML = plusOne(5);

 

箭头函数=>

标签:this   htm   UNC   inner   fun   bsp   html   实例   class   

原文地址:https://www.cnblogs.com/potatorain/p/11421171.html

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