How to pass a function as an argument?

Posted by TFerrell on Stack Overflow See other posts from Stack Overflow or by TFerrell
Published on 2010-05-19T18:39:15Z Indexed on 2010/05/19 19:00 UTC
Read the original article Hit count: 156

Filed under:
|

I'm looking to pass an anonymous function to another function, but it doesn't seem to be working as I'd like.

I've attached the code, I think it'd give you a better idea what I'd to do.

<script language="javascript" type="text/javascript">
function do_work(success) {
    success;
}

do_work(function () {
    alert("hello")
});

</script>

Thanks in advance for any help.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about function