Ad
  • Custom User Avatar

    I'm all the way down to test 28. Where the function declared is var id = function (id) { return id; }
    But when I print the given function I actually get function id(_id) { return _id; }
    The argument passed into the defaultArguments is { id: 'test' }
    My first question is: Is there a special meaning to parameters prefixed with _?

    Second, when I work around this test by ignoring any _ prefix. The second test which calls the exact same function, and passes the exact same argument into defaultArguments expects the method not to return a default.
    Is this a broken test or am I missing something?

    My test output with some logging:
    var id = function (id) { return id; }

    function id(_id) {
    return _id;
    }
    Args: { id: 'test' }
    Test Passed: Value == test

    function id(_id) {
    return _id;
    }
    Args: { id: 'test' }
    defaultArguments(id,{id:"test"})(undefined) - Expected: undefined, instead got: test