Alternative to nested ternary operator in JS [closed]
Your alternatives here are basically: That if/else you don’t want to do A switch combined with if/else I tried to come up with a reasonable lookup map option, but it got unreasonable fairly quickly. I’d go for #1, it’s not that big: if (res.distance == 0) { word = ‘a’; } else if (res.distance == … Read more