function in setInterval() executes without delay

http://jsfiddle.net/wWHux/3/

You called the function immediately instead of passing it to setInterval.

setInterval( change, 1500 ) – passes function change to setInterval

setInterval( change(), 1500 ) – calls the function change and passes the result (undefined) to setInterval

Leave a Comment