re: 5 Programming Patterns I Like VIEW POST

FULL DISCUSSION
 

I love nested ternaries, shortens the code. A real world example, simple Vue-router meta controlling;

    const accessControl =
      to.meta.abKey === 'default'
        ? true
        : to.matched.filter(x => abKeys.includes(x.meta.abKey)).length > 0
        ? true
        : false;
 

cond1 ? true : cond2 ? true : false

is the same as

cond1 || cond2

code of conduct - report abuse