From db3e7a8a6a720395a5fe580a5ee7f5a29b54ab60 Mon Sep 17 00:00:00 2001
From: Saad Khalid <91637722+stargazer4@users.noreply.github.com>
Date: Fri, 16 Feb 2024 19:02:58 +0000
Subject: [PATCH] added functionality
---
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..136620f 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..efdf66c 100644
--- a/public/index.html
+++ b/public/index.html
@@ -41,6 +41,8 @@
+
+