wait 0.5 after function javascript

JavaScript
statement1();
setTimeout(function() {
    statement2();
}, 500);

Source

Also in JavaScript: