We're a place where coders share, stay up-to-date and grow their careers.
I would use const instead of var though (if you're gonna go es6).
const
var
And just for shits and giggles, the fn could be done as a one-liner:
const wow = arg => ({dog: "LOVELY", cat: "CUTE"}[arg] || "gimme an animal"); wow("cat");
Cool
I would use
const
instead ofvar
though (if you're gonna go es6).And just for shits and giggles, the fn could be done as a one-liner:
Cool