-
-
Save conanak99/0b3557a209548bb21dae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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