From 87d321e9ef53e6aca39ce38445235f6c2c2a4dd5 Mon Sep 17 00:00:00 2001 From: tommyZZM Date: Wed, 2 Dec 2015 16:25:29 +0800 Subject: [PATCH] Update style.md usage of Arrow function --- docs/style.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/style.md b/docs/style.md index 49cc1dd..28c4378 100644 --- a/docs/style.md +++ b/docs/style.md @@ -260,9 +260,14 @@ const nodes = Array.from(foo); }); // good -[1, 2, 3].map((x) => { +[1, 2, 3].map(x => { return x * x; }); + +// with more than one argument +[1, 2, 3].map((x,i) => { + return x * i; +}); ``` 箭头函数取代`Function.prototype.bind`,不应再用self/\_this/that绑定 this。