Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created January 13, 2016 01:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save leandromoreira/cad4e841ac7e7596b501 to your computer and use it in GitHub Desktop.
var print = (list) => {
list.forEach((item) => {
// naming become harder :(
var itemDescription
if (typeof item === "object") {
itemDescription = item.name
} else {
itemDescription = item
}
console.log(`Annyong, ${itemDescription}`)
})
}
print([1,2,3])
print(["d","k","c"])
print([{name: "Buster Lose Seal"}, {name: "Neo Cortex"}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment