diff --git a/calculator.js b/calculator.js index caf34db..d6f35a1 100644 --- a/calculator.js +++ b/calculator.js @@ -1,5 +1,5 @@ function isNumber(numStr){ - var re = /^[0-9\.]+$/; + var re = /^-?[0-9]+.?[0-9]*$/; return re.test(numStr); } @@ -11,5 +11,15 @@ function substract(num1, num2){ return num1 - num2; } +function multiply(num1 ,num2){ + return num1*num2; +} + +function divide(num1 , num2){ + return num1/num2; +} module.exports.add = add; +module.exports.substract = substract; +module.exports.multiply = multiply; +module.exports.divide = divide; module.exports.isNumber = isNumber; diff --git a/index.html b/index.html index cc6a9d9..1f2db54 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,9 @@

Silly Calculator

+