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

220
Views
TypeError: inner is not a function

In the below code snippet, why I am getting the error inner is not a function?

var inner = 10;

function inner() {
  console.log("Hey type", typeof inner);
}
inner()

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Because of the way hoisting works in javascript the inner function declaration is fully declared (and callable) before the inner-variable gets assigned the number value. So you are actually overriding the inner function with a number in line 1.

Using a function expression instead will output the result function. I guess that is what you expected.

var inner = 10;

var inner = function() {
  console.log("Hey type", typeof inner);
}
inner()

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!