DEV Community

Discussion on: There's no "else if" in JS

Collapse
 
slumboy profile image
slumboy • Edited

try node.js and es6
example

Collapse
 
mahlongumbs profile image
Mahlon Gumbs

I would use const instead of var though (if you're gonna go es6).

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");
Collapse
 
slumboy profile image
slumboy

Cool