Merge pull request #5573 from exacs/docs-babel-plugin-transform-es2015
Improve example of babel-plugin-transform-es2015-arrow-functions
This commit is contained in:
commit
0b917c00d6
@ -27,12 +27,12 @@ console.log(bob.printFriends());
|
|||||||
**Out**
|
**Out**
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
var a = function a() {};
|
var a = function () {};
|
||||||
var a = function a(b) {
|
var a = function (b) {
|
||||||
return b;
|
return b;
|
||||||
};
|
};
|
||||||
|
|
||||||
var double = [1, 2, 3].map(function (num) {
|
const double = [1, 2, 3].map(function (num) {
|
||||||
return num * 2;
|
return num * 2;
|
||||||
});
|
});
|
||||||
console.log(double); // [2,4,6]
|
console.log(double); // [2,4,6]
|
||||||
@ -40,7 +40,7 @@ console.log(double); // [2,4,6]
|
|||||||
var bob = {
|
var bob = {
|
||||||
_name: "Bob",
|
_name: "Bob",
|
||||||
_friends: ["Sally", "Tom"],
|
_friends: ["Sally", "Tom"],
|
||||||
printFriends: function printFriends() {
|
printFriends() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
this._friends.forEach(function (f) {
|
this._friends.forEach(function (f) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user