Skip to content

Instantly share code, notes, and snippets.

@katakeynii
Last active July 18, 2018 09:26
Show Gist options
  • Save katakeynii/2a7bb0789af66488559299da8d16fb27 to your computer and use it in GitHub Desktop.
Save katakeynii/2a7bb0789af66488559299da8d16fb27 to your computer and use it in GitHub Desktop.
const throwMissing = (parent) => { throw new Error(`le nom de ${parent} doit etre renseigné`) }
const CodeFamille = (papa = throwMissing("papa"), mere = throwMissing("Maman"), ...children ) => {
if(children.length == 0){
console.log(" Pas d'enfants ")
return;
}
console.log("Papa: ", papa, "Maman: ", mere, "enfants :", children )
}
CodeFamille("Moussa")
@adyngom
Copy link

adyngom commented Jul 17, 2018

pourquoi pas

const throwMissing = (str) => { throw new Error(`${str} doit etre renseigné`)}
// et dans code famille tu aurais
const CodeFamille = (papa = throwMissing('papa'), mere = throwMissing('maman'), ...children )

@katakeynii
Copy link
Author

Susu j'avais vu cela j'ai modifié thanks great (y)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment