Have anyone can explain to me the meaning of () in last line;?

const half = (function() {
“use strict”; // do not change this line

// change code below this line
return function half({max, min}) {
// use function argument destructuring
return (max +min) / 2.0;
};
// change code above this line

})();

(function() {
})();

This is the equivalent of javascript’s document.ready. It is a shortcut for this function. The () are placed behind it so you know it is a function that is executed.

completely empty it would look like this. ()();

1 Like

const half = (function() {
“use strict”; // do not change this line

// change code below this line
return function half({max, min}) {
// use function argument destructuring
return (max +min) / 2.0;
};
// change code above this line

}()
);

Can i write like this???

No. the placements of the () are important. it is how your computer knows it should execute a function.

1 Like

so lovely, tks biirra, hope be a friend with you!!!