Intermediate Algorithm Scripting - Arguments Optional

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

function addTogether() {
  const [first, second] = arguments
  if (typeof first !== "number")
  return undefined
  if (second === undefined)
  return (second) => addTogether(second, first)
  if (typeof second !== "number")
  return undefined
  return first + second

console.log(addTogether(5, 0));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Intermediate Algorithm Scripting - Arguments Optional

Link to the challenge:

addTogether(5, undefined)

should return


this will take out that error, but this is not a solution for all test cases, happy algoing :slight_smile:

Maybe idk how to add it because it has taken much in mind. Honestly i dont know where to put to run all commands

i rewrote this as such, now it should require a bit more tweaking to complete this step, see if this helps you in any way, happy learning :slight_smile:


Please don’t write solution code for other users.

okay noted :slight_smile: i was just re writing from that source code not any “functioning solution” code :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.