Skip to content

Instantly share code, notes, and snippets.

@conanak99
Last active March 9, 2016 00:44
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 conanak99/0b3557a209548bb21dae to your computer and use it in GitHub Desktop.
Save conanak99/0b3557a209548bb21dae to your computer and use it in GitHub Desktop.
var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
// Giả sử ta muốn tìm các số chẵn
// Cách viết cũ
var odd = numbers.filter(function(n) { return n % 2 == 1 });
console.log(odd);
// Với arrow
odd = numbers.filter(n => n % 2 == 1);
console.log(odd);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment