Skip to content

Commit

Permalink
added sum to known functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhao committed Jan 26, 2021
1 parent 9f5e3bf commit 79b0c9e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion knownFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "") {
Expand Down

0 comments on commit 79b0c9e

Please sign in to comment.