Skip to content

Instantly share code, notes, and snippets.

@rcdexta
Created March 28, 2019 03:12
Show Gist options
  • Save rcdexta/dff2c2669edf02b16669f64efa39e7f4 to your computer and use it in GitHub Desktop.
Save rcdexta/dff2c2669edf02b16669f64efa39e7f4 to your computer and use it in GitHub Desktop.
iterate array
_.each([1, 2, 3], (value, index) => {
console.log(value)
})
[1, 2, 3].forEach((value, index) => {
console.log(value)
})
_.forEach({ 'a': 1, 'b': 2 }, (value, key) => {
console.log(key);
});
({ 'a': 1, 'b': 2 }).forEach((value, key) => { // !error
console.log(key);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment