Skip to content

Instantly share code, notes, and snippets.

@ranamahmud
Created November 7, 2020 06:59
Show Gist options
  • Save ranamahmud/8ed981c49c78526d13a435c2a67f823a to your computer and use it in GitHub Desktop.
Save ranamahmud/8ed981c49c78526d13a435c2a67f823a to your computer and use it in GitHub Desktop.
const nums = [1, 2, 3, 4, 5, 6, 7, 8, 9];
function greater(num) {
return num > 5;
}
const largeNumbers = nums.filter(greater);
console.log(largeNumbers)
\\ [ 6, 7, 8, 9 ]
const largeNumbers2 = nums.filter(number => number > 5);
console.log(largeNumbers)
\\ [ 6, 7, 8, 9 ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment