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

155
Views
Does Closure exist in a Nested function without variables

Can we say a closure exist in this code

function foo(){
        return function foo2(){
                   console.log("Inner Function");
          }
}

let x = foo();
x();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

No the inner function is not a closure here. It is not accessing any variable which is outside the scope.

Here is the snapshot from chrome console.

Inner function

But when the inner function access a variable defined outside its scope the whole environment that is function with references to its surrounding becomes a closure. You can see scope closure in the console

Closure

about 4 years ago · Juan Pablo Isaza Report
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!