Passing As Argument

This is passing an anonymous function in as an argument to another function.


Without a Return

setTimeout(function() { 
    console.log('Execute later after 1 second')
}, 1000);

With a Return

window.alert( function() { return arguments[0] + arguments[1] }) (1,2)); 




© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext