delay x miliseconds
setTimeout(function() { your_func(); }, 5000); To avoid scoping problemos use arrow functions setTimeout( () => { }