From 79b0c9e1283e48f59692886d50b3fd61eb1de5c5 Mon Sep 17 00:00:00 2001 From: Zhao Date: Mon, 25 Jan 2021 21:21:40 -0500 Subject: [PATCH] added sum to known functions --- knownFunctions.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/knownFunctions.js b/knownFunctions.js index ff250ec..4c35afe 100644 --- a/knownFunctions.js +++ b/knownFunctions.js @@ -94,7 +94,13 @@ export const knownFunctions = { if (typeof y == "string" && document.getElementById(y)) { y = document.getElementById(y).value; } - return x - y; + return parseInt(x) - parseInt(y); + }, + sum: function (x, y) { + if (typeof y == "string" && document.getElementById(y)) { + y = document.getElementById(y).value; + } + return parseInt(x) + parseInt(y); }, percentDiff: function (x, y) { if (x == "" || y == "") {