Ad
  • Default User Avatar

    Decent enough solution, but readability isnt great, you could have formatted it in an easier to read style but nested ternaries are always hard to read properly.

    something like this perhaps
    return operation === "+"
    ? value1 + value2
    : operation === "-"
    ? value1 - value2
    : operation === "*"
    ? value1 * value2
    : operation === "/"
    ? value1 / value2
    : false;