mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-28 21:32:20 +00:00
Update style.md
This commit is contained in:
parent
372eb0f67f
commit
421b8ab321
@ -260,11 +260,15 @@ const nodes = Array.from(foo);
|
|||||||
});
|
});
|
||||||
|
|
||||||
// good
|
// good
|
||||||
|
[1, 2, 3].map((x) => {
|
||||||
|
return x * x;
|
||||||
|
});
|
||||||
|
|
||||||
|
// best
|
||||||
[1, 2, 3].map(x => x * x);
|
[1, 2, 3].map(x => x * x);
|
||||||
|
|
||||||
// with more argument and code
|
// best
|
||||||
[1, 2, 3].map((x,i) => {
|
[1, 2, 3].map((x,i) => {
|
||||||
console.log(x);
|
|
||||||
return x * i;
|
return x * i;
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user