Hello,
Arguments Optional
I tried to use the “Currying”, but I did have success, is it possible ?
function addTogether(x, y) {
let array = []
array.push(x,y)
if (array.every(item => !Number.isInteger(item)&& array.length == 2)) {
return undefined
} else if (array.every(item => Number.isInteger(item) && array.length == 2)) {
return x + y
}
else if (array.length == 1 && Number.isInteger(array[0])) {
return function curry(x, y) {
return function(x) {
return function(y) {
return x + y;
}
}
}
}
}
addTogether(2)(5);