Help|Set Default Parameters for Your Functions

Tell us what’s happening:
why there is "(" first function and at the end") ();"

Your code so far

const increment = (function() {
  "use strict";
  return function increment(number, value=1) {
    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 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36.

Link to the challenge:

that is an Immediately Invoked Function Expression (IIFE), it is a thing to make sure the tests work appropriately. You just need to know that functions can be returned from other functions, but it works as any other function

1 Like

Thanks i understand now :smile: