Skip to content

Instantly share code, notes, and snippets.

@conanak99

conanak99/arrow.es6.js Secret

Last active Mar 9, 2016
Embed
What would you like to do?
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