diff --git a/script.js b/script.js index 611eeb1..4dd1e09 100644 --- a/script.js +++ b/script.js @@ -56,13 +56,16 @@ function Calculator(str) { op = parts[1]; b = +parts[2]; + + if (a && !b) { + return a; + } if (isNaN(a) || isNaN(b)) { return NaN; } if (!this.methods[op]) { return "Operation not supported." } - return this.methods[op](a, b); }; } \ No newline at end of file