3 ms·
Take it one step further, and move the switched-over value to the top: ((o) => o[expr_to_switch_over()])({ opt1: () => { stmts(); }, opt2:
by jpochtar 8y ago
Take it one step further, and move the switched-over value to the top:
((o) => o[expr_to_switch_over()])({
opt1: () => {
stmts();
},
opt2: () => {
stmts();
},
opt3: () => {
stmts();
}
})
- ezekg 8y agoAnd then you can call it a “switch statement”!