Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created January 13, 2016 01:19
  • 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/edbf4378b9bbcb58aebd to your computer and use it in GitHub Desktop.
var print = (list) => {
list.forEach((item) => {
var itemDescription
if (typeof item === "object") {
itemDescription = item.name || item.brand
if (item.arch) {
itemDescription = `${item.name} - ${item.arch}`
}
} else {
itemDescription = item
}
console.log(`Hello, ${itemDescription}`)
})
}
print([1,2,3])
print(["D","K","C"])
print([{name: "Buster Lose Seal"},{name: "Neo Cortex"}])
print([{brand: "Ferrari"}, {brand: "Mercedes"}])
print([{name: "N64", arch: "MIPS"}, {name: "3DS", arch: "ARM9"}])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment