ES6 Arrow Function & this bug let accHeadings = document.querySelectorAll(`.accordionItemHeading`); // NodeList(3) // let accHeadings = [...document.querySelectorAll(`.accordionItemHeading`)]; for (let i = 0; i < accHeadings.length; i++) { accHeadi…
Arrow Function.md Arrow Functions The basic syntax of an arrow function is as follows var fn = data => data; The code means : var fn = function( data ) { return data; } let getNumber = () => 42; console.log(typeof getNumber); console.log(getNumber()…
为什么叫Arrow Function?因为它的定义用的就是一个箭头: x => x * x 上面的箭头函数相当于: function (x) { return x * x; } 箭头函数 阅读: 45060 ES6标准新增了一种新的函数:Arrow Function(箭头函数). 为什么叫Arrow Function?因为它的定义用的就是一个箭头: x => x * x 上面的箭头函数相当于: function (x) { return x * x; } 在继续学习箭头函数之前,请测试你的浏览…