How to check if a Javascript function exists

<script language=”javascript” type=”text/javascript”>

function myFunction() {

}
if(window.myFunction) {

alert(“‘myFunction’ already exists”);

} else {

alert(“‘myFunction’ does not already exists”);

}

</script>

Share

Leave a Reply

Your email address will not be published. Required fields are marked *