Software Engineer
Output Analysis of the Loop
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();
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.