Created
April 29, 2021 15:12
-
-
Save leonidkuznetsov18/c998388f9ef64134a02c2fa625dc87b7 to your computer and use it in GitHub Desktop.
closure push to array
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 gArray = () => { | |
| var array = []; | |
| const a = (value) => { | |
| array.push(value); | |
| return array; | |
| } | |
| return a; | |
| }; | |
| const b = gArray(); | |
| b(1) | |
| b(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment