Skip to content

Instantly share code, notes, and snippets.

@NyaGarcia
Last active March 5, 2021 22:14
Show Gist options
  • Save NyaGarcia/76e7ca13a60b632c07dea5acf2afcd7d to your computer and use it in GitHub Desktop.
Save NyaGarcia/76e7ca13a60b632c07dea5acf2afcd7d to your computer and use it in GitHub Desktop.
Setting default parameters in an arrow function
const choosePokemon = (
firstPokemon = "Charmander",
secondPokemon = "Bulbasaur"
) => `I choose ${firstPokemon} and ${secondPokemon}`;
// Calling function without parameters
console.log(choosePokemon());
// Output: I choose Charmander and Bulbasaur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment