From ae93e1cd83ee4773fea48fed44560f626a58d57d Mon Sep 17 00:00:00 2001 From: Saad Khalid <91637722+stargazer4@users.noreply.github.com> Date: Tue, 27 Feb 2024 21:55:56 +0000 Subject: [PATCH] changes --- api/controller.js | 1 + public/client.js | 3 +++ public/index.html | 2 ++ 3 files changed, 6 insertions(+) diff --git a/api/controller.js b/api/controller.js index 949731c..92077e1 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 }, + 'pow': function(a, b) { return Math.pow(a, b) }, }; if (!req.query.operation) { diff --git a/public/client.js b/public/client.js index 1c60f86..f702edd 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=pow"; + break; default: setError(); return; diff --git a/public/index.html b/public/index.html index 400c454..4e9dbae 100644 --- a/public/index.html +++ b/public/index.html @@ -41,6 +41,8 @@ + +