Recursive setTimeout

Recursive setTimeout

BY 09 Nov 2015 Web Code Snippet
Shows how to use setTimeout method as setInterval method. In this example colourChangerFunction method is called every 3 seconds with setTimeout instead of setInterval. Div element with id=”colouredDiv” changes it’s colour every 3 seconds. getRandomColour method generates random Hex colour code.
Written by