Home > shorts > You can use logical operator 'or' insted of ternary operator

You can use logical operator 'or' insted of ternary operator


In some cases you can use logical operator 'or' insted of ternary operator

const returnTest = testTrue => testTrue ? testTrue : testFalse

const returnTest = testTrue => testTrue || testFalse

Check the demo here => CodePen

© 2021, Andrew Losseff