Intermediate algorithms javascript

Intermediate algorithms javascript


Hey Guys I need to understand the following lesson I can’t understand it at all


If you don’t remember the optional arguments in javascript (ES6 => rest operator) then revisit the exercise again. The function will look something like this

function addTogether(your code for optional arguments) {
  // if two arguments and the arguments are numbers

    // return sum of the numbers

  // else if one argument and the argument is a number

    //return a function that takes a number as an argument

        // if the argument is a number

           // return the sum of the previous argument and the current argument 

       // else

          // return undefined

  // else

  //  return undefined

Hope, this helps.