Fonctions Fat Arrow
Depuis l'ES6, il existe une nouvelle syntaxe pour créer des fonctions :
const addRandom = (a) =>
{
return a + Math.random()
}
// S'il n'y a qu'un paramètre, peut s'écrire sans les parenthèse
const addRandom = a =>
{
return a + Math.random()
}
// Si ne contient qu'une instruction `return`
const addRandom = a => a + Math.random()Last updated