Skip to content

Instantly share code, notes, and snippets.

@AlexLo33
Created February 28, 2018 13:08
Show Gist options
  • Save AlexLo33/58e7b8e4991b7c2fddae80cfdf273961 to your computer and use it in GitHub Desktop.
Save AlexLo33/58e7b8e4991b7c2fddae80cfdf273961 to your computer and use it in GitHub Desktop.
(() => {
'use strict';
const address = {
city: "Lyon",
state: "FR",
zip: 69001
};
const listeSports = ['Football', 'BasketBall']
const autreListeSports = ['Boxe', 'Judo']
function afficher({
city: cityName
}, sports = []) {
if (sports.length > 0) {
return `La ville de ${cityName} est ouverte aux sports suivants : ${[...sports]}`;
} else {
return `Aucun sport n'est disponible dans la ville de ${cityName}`;
}
}
console.log(afficher(address, [...listeSports, ...autreListeSports]));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment