ServiceNow
ServiceNow

Software Engineer

Output Analysis of the Loop

Medium
ROUND 2: Technical Discussion & Problem-SolvingOutput-BasedCandidate Selected

Given this function, what will be the output and why? javascript function foo() { for (var i = 0; i < 10; i++) setTimeout(() => console.log(i), 1000); } foo();

Code Snippets
javascript
function foo() {
 for (var i = 0; i < 10; i++) setTimeout(() => console.log(i), 1000);
}
foo();

This question was asked in

ServiceNow Software Engineer Interview Experience

The ServiceNow Frontend Software Engineer interview process involved multiple rounds of technical discussions and problem-solving. In Round 1, candidates faced JavaScript-based questions, covering topics such as output analysis, event loops, promises, and Angular concepts, followed by more complex problems in Round 2, including dynamic programming challenges and system design for an Autocomplete component. Overall, the interview experience at ServiceNow appears to be rigorous, emphasizing deep technical knowledge and problem-solving skills.

AI Powered

Share Your Story

Share your interview in your own words — our AI handles the rest. Hardly takes 2 minutes.

Take Mock Interview

Prepare better with expert feedback

Want to Connect 1:1?

Connect with me 1:1 for career guidance, resume reviews, interviews, and more.

Show Your Love!

Connect with us on social media