Difference between these two declarations of immediate functions

Asked

Viewed 35 times

2

What’s the difference between:

(function() {
    console.log('Hello :)');
})();

and:

(function() {
    console.log('Hello :)');
}());

? The two snippets of code do the same thing, so I was wondering if there’s any difference beyond writing or if they’re just different ways of doing the same thing, no performance implications and so on...

  • (In syntax they are different things.)

1 answer

3


They are just two different ways to perform the immediate execution of a javascript function without difference in performance between them.

This question about which of the forms would be the best to use is answered in the community. Follow the link: Immediate Function Invocation syntax

Browser other questions tagged

You are not signed in. Login or sign up in order to post.