Skip to content

Instantly share code, notes, and snippets.

@tofusoup429
Created February 5, 2021 02:02
Show Gist options
  • Save tofusoup429/a44531ce2982b20341a750eb848b3729 to your computer and use it in GitHub Desktop.
Save tofusoup429/a44531ce2982b20341a750eb848b3729 to your computer and use it in GitHub Desktop.
let originalArray = [1,2,3,4,5,6];
let returnValue = originalArray.forEach((element, index, array)=>{
if(element%2) console.log(index, element, array);
})
console.log('returnValue', returnValue)
/**
0 1 [ 1, 2, 3, 4, 5, 6 ]
2 3 [ 1, 2, 3, 4, 5, 6 ]
4 5 [ 1, 2, 3, 4, 5, 6 ]
returnValue undefined
**/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment