odin-js-fundamentals-part-5/08_calculator/calculator.js

37 lines
453 B
JavaScript

const add = function(a, b) {
return a + b;
};
const subtract = function(a, b) {
return a - b;
};
const sum = function(array) {
const output = array.reduce((total, value) => {
return total + value;
}, 0);
return output;
};
const multiply = function() {
};
const power = function() {
};
const factorial = function() {
};
// Do not edit below this line
module.exports = {
add,
subtract,
sum,
multiply,
power,
factorial
};