Second one will make a function named increment, that you could want to invoke later.
First one is an IIFE,(Immediately Invoked Function Expression) a self invoking function that would assign the value of its result to the const increment.
An IIFE (Immediately Invoked Function Expression) is a JavaScript function that runs as soon as it is defined.
(function () {
statements
})();
there is no difference, but it is better to create the separate function. Having a separate function allows you to call it from multiple places, but only define it one time, and make your code more readable