This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Flatten array | |
| const flatten = (arr) => [].concat.apply([], arr); | |
| //To use | |
| const arrToFlatten = [ | |
| ["1"], | |
| ["2"], | |
| ["3"], | |
| ["4"] | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const SingletonPattern = (() => { | |
| let instantiated; | |
| let init = () => { | |
| // singleton | |
| return { | |
| publicMethod: () => { | |
| console.log("hello world"); | |
| }, | |
| publicProperty: "test" |