Last active
December 16, 2015 05:19
-
-
Save pauldub/5383113 to your computer and use it in GitHub Desktop.
Dart's =>
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 fruits = [ | |
'banane', | |
'mangue', | |
'orange' | |
]; | |
// L'operateur => c'est un shorthand pour les fonction de ce genre la si on l'appliquait a du JS | |
_.filter(fruits, function (fruit) { | |
return fruit.match(/^b/) | |
}); | |
// La meme en utilisant => | |
_.filter(fruits, (fruit) => fruit.match(/^b/)); | |
// On peut ecrire avec cette syntaxe les fonctions anonymes d'une ligne, le return est induit. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment