Skip to content

Instantly share code, notes, and snippets.

@leonidkuznetsov18
Created April 29, 2021 15:12
Show Gist options
  • Select an option

  • Save leonidkuznetsov18/c998388f9ef64134a02c2fa625dc87b7 to your computer and use it in GitHub Desktop.

Select an option

Save leonidkuznetsov18/c998388f9ef64134a02c2fa625dc87b7 to your computer and use it in GitHub Desktop.
closure push to array
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