setTimeout(function(){console.log('Delayed by 2 sec')},2000);
Above function will wait for 2 sec before executing the function.