@kevdev Hint: You must be able to transform the first sample into the second sample purely by means of copy and paste. If you can't do that, the two code samples are not equivalent.
– TomalakSep 23 '15 at 21:21

3

@zzzzBov No. It indicates that you did not understand the fundamental difference between foo and foo(). And this is a semantic mistake, completely different from mistyping the function name or writing , instead of ; in a for loop statement. And people asking questions about their semantic mistakes are here to learn, in stark contrast to the "please fix my code" crowd. They are as on topic as it gets.
– TomalakSep 23 '15 at 21:31

1

No. It is not a typographical error - because, up until now, I did not know it made a difference as to when a function is run between it being passed as parameter or being called. I naively thought that the STEP() functions would be called after the delay. Certainly not a typo.
– kevdevSep 23 '15 at 21:36

Well that certainly did the trick but leaves me still confused. It can be boiled down to this: delay(2000).then(function () {console.log("After 2000ms")}); works but `delay(2000).then(console.log("After 2000ms"));' doesn't
– kevdevSep 23 '15 at 21:26

2

@kevdev - you have to pass a function reference so that the promise infrastructure can call it later. function () {console.log("After 2000ms")} is a function reference. console.log("After 2000ms") is not a function reference. That runs console.log() immediately and passes the return result from executing it which is undefined.
– jfriend00Sep 23 '15 at 22:49