Understanding “setTimeout()” and “setInterval()” timer methods

Read the tutorial on YogiHosting »

1. setTimeout() - Show alert('hi') after 2 seconds

2. setTimeout() - Show alert() with parameters after 2 seconds

3. setInterval() - Show alert() every 2 seconds

4. setInterval() - Show alert() with parameters after 2 seconds