Skip to content

Commit d527bd0

Browse files
authored
better readability
1 parent a7913f8 commit d527bd0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.verb.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ Sort an array by the given object property:
55
```js
66
var arraySort = require('{%= name %}');
77

8-
arraySort([{foo: 'y'}, {foo: 'z'}, {foo: 'x'}], 'foo');
8+
var arr = [{foo: 'y'}, {foo: 'z'}, {foo: 'x'}];
9+
arraySort(arr, 'foo');
910
//=> [{foo: 'x'}, {foo: 'y'}, {foo: 'z'}]
1011
```
1112

1213
**Reverse order**
1314

1415
```js
15-
arraySort([{foo: 'y'}, {foo: 'z'}, {foo: 'x'}], 'foo', {reverse: true});
16+
var arr = [{foo: 'y'}, {foo: 'z'}, {foo: 'x'}];
17+
arraySort(arr, 'foo', {reverse: true});
1618
//=> [{foo: 'z'}, {foo: 'y'}, {foo: 'x'}]
1719
```
1820

0 commit comments

Comments
 (0)