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