re: Daily Challenge #10 - Calculator VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Alright, I'm gonna be the one who posts this. const calc = exp => eval(exp)
 

Similarly unfair, the solution in R:

calc <- function (expr) {
    eval(parse(text=expr))
}
> calc("2 / 2 + 3 * 4 - 6")
[1] 7

Warning: don't do this.

code of conduct - report abuse