Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
What would be a use case for immediately invoked functions in JavaScript?

If we define a function

(function(){ 
  console.log("");
})();

then it is invoked immediately. We could define the same function

function foo(){ 
  console.log("");
}
foo();

I fail to see a good use case for this, but if there is one, then I don't see why we not just define a normal function and call it. Why should we use immediately invoked functions and what are their advantages?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!