Javascript check if function exists
Hi! For example, you need to know if a function exists in order to execute it.To check for the existence of a js function, you can do so in a simple way: It’s all very simple. That’s how you check if a JavaScript function exists.
Hi! For example, you need to know if a function exists in order to execute it.
To check for the existence of a js function, you can do so in a simple way:
if(typeof myFunc== 'function') {
// Function myFunc exists
// Call the function
myFunc();
}
It’s all very simple. That’s how you check if a JavaScript function exists.
