Update calculator.js

This commit is contained in:
Mayar-Hassanin98 2020-07-25 16:49:19 +02:00 committed by GitHub
parent 888383a44e
commit e64d488a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 17 deletions

View File

@ -1,25 +1,33 @@
function add () { function add (a,b) {
return a+b;
}
function subtract (a,b) {
return a-b;
}
function sum (array) {
return array.reduce(total,current )=> total+=current,0);
} }
function subtract () { function multiply (a,b) {
return array.length? array.reduce(accumaltor,nextitem )=> accumaltor*nextitem):0;
}
function power(a,b) {
return Math.pow(a,b)
} }
function sum () { function factorial(a) {
if(a==o)return;
} let fact=1;
for(let i=n ;i<0 ;i--)
function multiply () { {
fact*=1;
} }
return fact;
function power() {
}
function factorial() {
} }
module.exports = { module.exports = {