Tell us what’s happening:
Why are there empty parenthesis at the end of the increment function? If you remove them console log doesn’t print so these are doing something, but what? I’ve never seen this before.
Also why is this question mixing ES6 and non-ES6 syntax. Not only is this confusing but it counter productive in a section that is suppose to be about using ES6 syntax.
Your code so far
const increment = (function() {
"use strict";
return function increment(number, value) {
return number + value;
};
})();
console.log(increment(5, 2)); // returns 7
console.log(increment(5)); // returns 6
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/set-default-parameters-for-your-functions