Skip to content

Instantly share code, notes, and snippets.

@mkczarkowski
Last active October 20, 2018 11:48
Show Gist options
  • Select an option

  • Save mkczarkowski/aa14615c09075ba2ef50586249920536 to your computer and use it in GitHub Desktop.

Select an option

Save mkczarkowski/aa14615c09075ba2ef50586249920536 to your computer and use it in GitHub Desktop.
const array = [1, 2, 3, 4, 5, 6];
// Rozwiązanie z użyciem deklaracji funkcji.
function isEven(num) {
return num % 2 === 0;
}
function square(num) {
return num * num;
}
const squareOfEvens = array.filter(isEven).map(square);
// Rozwiązanie z wykorzystaniem funkcji strzałkowych.
const isEven = num => num % 2 === 0;
const square = num => num * num;
const squareOfEvens = array.filter(isEven).map(square);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment