Skip to content

Commit 01bb1e7

Browse files
committed
Functional programming singletom example
1 parent b422272 commit 01bb1e7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

JavaScript/5-fp.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
const singleton = (instance => () => instance)({});
4+
5+
// Usage
6+
7+
console.assert(singleton() === singleton());
8+
console.log('instances are equal');

0 commit comments

Comments
 (0)