Live Chat Icon For mobile
Live Chat Icon

How can we check whether a function exists in javascript?

Platform: ASP.NET| Category: Client Side Scripting

We can check the existence of a function by Window.FunctionName as shown below, where the FunctionName is the name of the function,whose existence has to be checked.


<SCRIPT LANGUAGE='JavaScript' type='text/javascript'>
functionCheckIfExists()
{
	alert(’FunctionExists’)
}
if( window.CheckIfExists)
{
 	CheckIfExists()
}
else
{
 	alert( Function Not Exists!’ )
}
</SCRIPT>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.