DEV Community

Discussion on: A simple tip for cleaner code

Collapse
bizzy237 profile image
Yury • Edited on

var dict = {'1':'YES',
'0':'MAYBE',
'-1':'NO'};

function foo($bar) {
    return dict[Math.sign($bar)];
}