I would like to create function what does this:
const doMath = (operator) => {
return 5 operator 2;
}
doMath('+')
doMath('-')
I was thinking on something like that:
const doMath = (operator) => {
return 5 (operator === '+' ? + : -) 2;
}
But I am missing something.