[JavaScript] Check if a function Exists or Not

JavaScript Logo

If you want to check if a function exists or not before calling, here’s how to do it

if(typeof window.functionName == 'function') {
functionName (arg1, arg2);

It returns a boolean value indicating if the function exists or not.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.