Ternaries make code difficult to read and maintain.

const positiveOrNegative = x => (x > 0 ? 'positive' : 'negative');
function positiveOrNegative(x) {
if (x > 0) {
return 'positive';
} else if (x < 0) {
return 'negative';
}
return '';
}
function positiveOrNegative(x) {
if (x > 0) {
return 'positive';
}
return 'negative';
}

--

--

--

Previously Paris and Geneva, currently New York. Can also be found at https://dev.to/arnaud

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Arnaud Dostes

Arnaud Dostes

Previously Paris and Geneva, currently New York. Can also be found at https://dev.to/arnaud

More from Medium

What to Pack for a Weekend in Italy

How I Taught My Daughters to Practice Safe Debt & Money Management

Dealing With Burnout

CS373 Spring 2022: Jay Park — Week 12