Skip to content

Commit cd96d8f

Browse files
committed
Optimize functional example
1 parent 175b100 commit cd96d8f

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

JavaScript/3-function.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
'use strict';
22

3-
const util = require('util');
4-
5-
const rect = (x, y, width, height) => {
6-
return {
7-
x, y, width, height,
8-
toString: () => `[${x}, ${y}, ${width}, ${height}]`
9-
};
10-
};
3+
const rect = (x, y, width, height) => ({
4+
x, y, width, height,
5+
toString: () => `[${x}, ${y}, ${width}, ${height}]`
6+
});
117

128
const square = (x, y, side) => rect(x, y, side, side);
139

0 commit comments

Comments
 (0)