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

67
Views
What will be output of this program in javascript

I was asked this question in an Interview for JS

function display() {
  var a = b = 10;
}
display();
console.log('b', typeof b === 'undefined');
console.log('a', typeof a === 'undefined');

My ans was : b false a false but according to the interviewer It should be b false a true

I didn't fully understood him . What should be the correct explanation/answer will be?

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

0

If you write like inside function then only answer will be false false.

function display() 
{
var a = b = 10;
console.log('b',  b === 'undefined');
console.log('a',  a === 'undefined');
}
display();
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!