Arguments Optional


This test is not working properly. Let me prove it.

Place this code in the function:

    return undefined;

Three cases are suppose to return undefined:

addTogether(“”) should return undefined.
addTogether(2, “3”) should return undefined.
addTogether(2)([3]) should return undefined. < -------- fails.

The last case fails to accept the undefined. I have been working on this for three days now,
I can follow up by posting my code. I have it set up so that it MUST return an undefined if either
parameter does not pass the typeof test, testing for ‘number’. Cannot proceed from here,
as there is no logical action left to take.

BTW, if you return 5, the test also fails on one outcome.


the test case is fine - the test case is


there are two function calls here - the first call is addTogether(2) - the second call is the function returned by addTogether(2) - the second call is passed the parameter [3]

what do you think happens for the second call if your entire definition of addTogether is

function addTogether() {
    return undefined;

btw - the above is equivalent to having a completely empty function body

function addTogether() {


The problem seems to be then that I cannot find were the JavaScript explanation of
this “first call and second call” phenomena then. I was viewing it as simply two
parameters because I could not find any examples or references to technical
info on a function that has (2)(3) this kind of thing following it.


I think the problem statement for is pretty clear about the two functions involved - I agree it is a conceptual leap from a single function call that returns simple values to a function that returns a function that is used immediately - maybe couple more exercises on functions as first-class objects are needed before this problem


Ok, I will look that over, thanks for the assistance!