Skip to content

Instantly share code, notes, and snippets.

@ogwurujohnson
Created August 27, 2020 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ogwurujohnson/46e824545b77950c99ae37596db43412 to your computer and use it in GitHub Desktop.
Save ogwurujohnson/46e824545b77950c99ae37596db43412 to your computer and use it in GitHub Desktop.
Loop and append to Another array
const getAddress = async (addresses) => {
const existingAddresses = [];
const res = addresses.map(async (item) => {
const address = await getAddressInfo({ nrg_address: item });
// console.log(address);
if (address) {
console.log("here");
return existingAddresses.push(address);
}
});
return Promise.all(res).then(() => existingAddresses);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment