DEV Community

Payalsasmal
Payalsasmal

Posted on

1 2

JS output-based Interview question

I recently encountered an intriguing question I'd like to share with you all. Take a guess at the expected output and share your insights! 😌
Image description

Top comments (7)

Collapse
 
miketalbot profile image
Mike Talbot ⭐ • Edited

1 4 6 9 2 5 undefined undefined 8 3?

Not 100% on whether the promise next tick guarantee will make the resolve trigger the first then before or after the 2, but guessing after.

EDIT: nope, the 2 is after the next tick promise so it's:

1 4 6 9 5 undefined undefined 8 2 3

Collapse
 
ceyed profile image
Saeed • Edited

1
9
2
4
6
5
7
8
3

Collapse
 
samsamit profile image
Samu Tiainen

1, 9, 2, 3
You just define the promise and never run it?

Collapse
 
gomigoku profile image
Gouthami

1
4
5
9
5
undefined
undefined
8
2
3

Collapse
 
ratgcode profile image
Raúl Tejedor

1
9
4
5
5
5
6
7
7
8
2
3

Collapse
 
payalsasmal profile image
Payalsasmal

No. Thik it once again

Collapse
 
itapas profile image
Tapas

1
4
6
9
5
undefined
undefined
8
2
3

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay