diff --git a/api/controller.js b/api/controller.js index 949731c..a9efaf1 100644 --- a/api/controller.js +++ b/api/controller.js @@ -16,6 +16,7 @@ exports.calculate = function(req, res) { 'subtract': function(a, b) { return a - b }, 'multiply': function(a, b) { return a * b }, 'divide': function(a, b) { return a / b }, + 'power': function(a, b) { return Math.pow(a, b) }, }; if (!req.query.operation) { diff --git a/public/client.js b/public/client.js index 1c60f86..1227a95 100644 --- a/public/client.js +++ b/public/client.js @@ -33,6 +33,9 @@ function calculate(operand1, operand2, operation) { case '/': uri += "?operation=divide"; break; + case '^': + uri += "?operation=power"; + break; default: setError(); return; diff --git a/public/index.html b/public/index.html index 400c454..33d4579 100644 --- a/public/index.html +++ b/public/index.html @@ -41,6 +41,7 @@ +