Skip to content

Commit 77cd28d

Browse files
committed
More factory examples
1 parent 6edf98c commit 77cd28d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

JavaScript/1-object.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ const userFactory3 = (name, group, email) => {
1212
name, group, email
1313
};
1414

15+
const userFactory4 = (name, group, email) => (
16+
name, group, email
17+
);
18+
1519
const user1 = userFactory1('marcus', 'emperors', 'marcus@spqr.it');
1620
console.log(user1);
1721

@@ -21,3 +25,7 @@ console.log(user2);
2125
const user3 = userFactory3('marcus', 'emperors', 'marcus@spqr.it');
2226
console.log(user3);
2327
// Explain: why undefined
28+
29+
const user4 = userFactory4('marcus', 'emperors', 'marcus@spqr.it');
30+
console.log(user4);
31+
// Explain: why 'marcus@spqr.it'

0 commit comments

Comments
 (0)