@@ -73,6 +73,8 @@ this does not mean, you have to avoid all new JavaScript features like list
73
73
comprehension or generators. Use them, when they make sense, but don't use them
74
74
when the resulting code is hard to read.
75
75
76
+ ** Please stick to using only standards compliant JavaScript.**
77
+
76
78
#### The most important style issues are:
77
79
78
80
- Use 4 spaces to indent things, no tabs, not 2, nor 8 spaces. If you use Vim,
@@ -145,29 +147,6 @@ when the resulting code is hard to read.
145
147
unfrob ();
146
148
```
147
149
148
- - Prefer lambda-style functions where suitable:
149
-
150
- ``` javascript
151
- // Good
152
- list .filter (function (elem ) elem.good != elem.BAD);
153
- list.forEach(function (elem) { window .alert (elem); });
154
-
155
- // Bad
156
- list .filter (function (elem ) { return elem .good != elem .BAD });
157
- list .forEach (function (elem ) window.alert(elem));
158
- ```
159
-
160
- - Anonymous function definitions should be formatted with a space after the
161
- keyword `function`:
162
-
163
- ```javascript
164
- // Good
165
- function () {}
166
-
167
- // Bad
168
- function () {}
169
- ` ` `
170
-
171
150
- Prefer the use of ` let ` over ` var ` i.e. only use ` var ` when required.
172
151
173
152
For more details, see:
@@ -195,20 +174,8 @@ when the resulting code is hard to read.
195
174
196
175
- Use UNIX new lines (` \n ` ), not windows (` \r\n ` ) or old Mac ones (` \r ` ).
197
176
198
- - Use ` Iterator` or ` Array#forEach` to iterate over arrays.
199
-
200
- ` for (let i in ary)` and ` for each (let i in ary)` include members in an
201
- ` Array.prototype` , which some extensions alter:
202
-
203
- ` ` ` javascript
204
- // Good
205
- for (let [,elem] in Iterator(ary))
206
- for (let [k, v] in Iterator(obj))
207
- ary.forEach(function (elem) { ...
208
-
209
- // Bad
210
- for each (let elem in ary)
211
- ` ` `
177
+ - Prefer Array iterator functions ` Array#forEach ` and ` Array#map ` over loops
178
+ and array comprehensions.
212
179
213
180
The exceptions to this rule are for objects with ` __iterator__ ` set, and for
214
181
XML objects (see README.E4X).
0 commit comments