Skip to content

Instantly share code, notes, and snippets.

@adamgiese
Created July 17, 2018 13:07
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 adamgiese/bed0cecaaba2e2143fed329a08b5c6fc to your computer and use it in GitHub Desktop.
Save adamgiese/bed0cecaaba2e2143fed329a08b5c6fc to your computer and use it in GitHub Desktop.
Declarative Arrays: Divisible By 3 Filter
const numbers = [1,2,3,4,5,6,7,8,9];
const divisibleByThree = numbers.filter(currentValue => currentValue % 3 === 0);
console.log(divisibleByThree); // [3,6,9];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment