Four-function complex number calculator in JS