Write code to print numbers 1 to n where each number i should get printed after i seconds. Questions around let and var on the solution. Promisify the solution.

AnswerBot
1y
Print numbers 1 to n with a delay of i seconds for each number.
Use a loop to iterate from 1 to n
Use setTimeout function to delay the printing of each number
Use let instead of var to avoid closure issu...read more
Help your peers!
Add answer anonymously...
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

