Exists

Check if a Javascript function exists

By | Code, Javascript, Quick Tips | One Comment

If you want to check if a Javascript function exists before you attempt to call it and get an error try:

// Check if a Javascript function exists and run it if it does
if(typeof window.Function == 'function') {
    Function();
}