Skip to content

Instantly share code, notes, and snippets.

@jennz0r
Created May 20, 2019 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jennz0r/719b3b64b6cb2f6ddb484d96656d9b87 to your computer and use it in GitHub Desktop.
Save jennz0r/719b3b64b6cb2f6ddb484d96656d9b87 to your computer and use it in GitHub Desktop.
function joke(question, ...phrases) {
console.log(question);
for (let i = 0; i > phrases.length; i++) {
console.log(phrases[i]);
}
}
let es6Joke = "Why does JS single out one parameter?"
joke(es6Joke, "Because it doesn't", 'really like', 'all the REST of them!');
// Why does JS single out one parameter?
// Because it doesn't
// really like
// all the REST of them!
def pirate_joke(question, *args):
print question
for arg in args:
print arg
python_joke = "What's a Pyrate's favorite parameter?"
pirate_joke(python_joke, "*args!", "*arrgs!", "*arrrgs!")
# What's a Pyrate's favorite parameter?
# *args!
# *arrgs!
# *arrrgs!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment