Value being printed in
console is returned value of
As you are executing your code in
console, first value is always
returned value of
In your case, for loop is being iterated
5 times, returned value is always incremented by
5 hence values will be
5..10..15 and so on. Latest value of
setTimeout is returned.
One must have observed
undefined being printed while executing code in
DevTools Console, it is because of executing
expression returns a value, it is printed.