Payalsasmal Posted on May 4, 2024 • Edited on May 4, 2024 JS output-based Interview question #discuss #javascript #interview #react 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! π Top comments (7) Subscribe Submit Preview Dismiss Collapse Expand Mike Talbot β Mike Talbot β Mike Talbot β Follow Serial CTO Location Bristol, UK Work Chief Technology Officer Joined May 18, 2020 • May 5 '24 • Edited on May 5 • Edited Dropdown menu Copy link Hide 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 Expand RaΓΊl Tejedor RaΓΊl Tejedor RaΓΊl Tejedor Follow Work Senior Web Dev Joined Mar 16, 2023 • May 4 '24 Dropdown menu Copy link Hide 1 9 4 5 5 5 6 7 7 8 2 3 Collapse Expand Payalsasmal Payalsasmal Payalsasmal Follow A Web developer, Frond-End Developer, and Technical Blogger Location India Work Senior Software Engineer at Visa Joined Oct 10, 2020 • May 4 '24 Dropdown menu Copy link Hide No. Thik it once again Collapse Expand Samu Tiainen Samu Tiainen Samu Tiainen Follow Enthusiastic software developer passionate about embracing change and exploring new horizons openly. Constantly seeking innovative solutions and eager to navigate the ever-evolving landscape of techno Location Finland Joined Dec 30, 2023 • May 5 '24 Dropdown menu Copy link Hide 1, 9, 2, 3 You just define the promise and never run it? Collapse Expand Saeed Saeed Saeed Follow I'm Ceyed Joined Aug 22, 2023 • May 5 '24 • Edited on May 5 • Edited Dropdown menu Copy link Hide 1 9 2 4 6 5 7 8 3 Collapse Expand Gouthami Gouthami Gouthami Follow A Software Developer Email gouthamisuvarna123@gmail.com Location Mangalore Pronouns She/Her Joined Mar 24, 2021 • May 21 '24 Dropdown menu Copy link Hide 1 4 5 9 5 undefined undefined 8 2 3 Collapse Expand Tapas Tapas Tapas Follow Frontend Engineer Location India Education Master of Computer Applications Work Frontend Engineer Joined May 8, 2024 • May 10 '24 Dropdown menu Copy link Hide 1 4 6 9 5 undefined undefined 8 2 3 Code of Conduct • Report abuse
Top comments (7)
1 4 6 9 2 5 undefined undefined 8 3?
Not 100% on whether the promise next tick guarantee will make the
resolvetrigger the firstthenbefore 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
1
9
4
5
5
5
6
7
7
8
2
3
No. Thik it once again
1, 9, 2, 3
You just define the promise and never run it?
1
9
2
4
6
5
7
8
3
1
4
5
9
5
undefined
undefined
8
2
3
1
4
6
9
5
undefined
undefined
8
2
3