-
## 函数语法选择
箭头函数的特点是:
1. 语法简单
2. 固定this
3. babel编译后性能会较低(因为固定this)
建议如下:
1. 在模块作用域(顶级作用域)的函数都使用`function foo() {}`,不要用箭头函数,这里用不了`this`
2. 如果需要变`this`或`this`不是当前词法`this`的,使用`function foo() {}`,典型的就是声明一…
-
It doesn't seem to work in **Acceptance** tests with Ember 3.9 + ember-qunit: 3.5.3
-
**Is this a feature or a bug?**
- [x] Feature
- [ ] Bug
**Please describe the actual behavior.**
This is a feature request to classify exported arrow functions as functions rather than varia…
-
nas5w updated
5 years ago
-
Currently, in the generation template, all the functions are rendered in `function AboutUsPage() {}` format.
Change this to arrow functions: `const AboutUsPage = () => {}` to preserve the consistency…
-
With the awesome work @andy-haynes did to refactor how props can be passed more naturally (without nesting them in a `props` object), I realized we could start using a more natural typed component syn…
-
Written on 05/16/2020 13:13:26
URL: https://dmitripavlutin.com/differences-between-arrow-and-regular-functions/
-
Arrow Function definitions. These examples are pulled from the ES6 Features website ( http://es6-features.org/ )
- [ ] Expression Bodies
``` JavaScript
/* New Method */
// Expression bodies
…
-
```
var foo = [1, 2, 3];
var bar = foo.map(x => x * x);
```
It would be nice if ES6 arrow functions (like the one above) were supported.
cpixl updated
6 years ago
-
Could you please add some rules to arrow functions so the code will be more consistent?
I suggest:
`arrow-body-style` set to `as-needed`
`arrow-parens` set to `always`
`implicit-arrow-linebreak`…