Javascript function_exists
Checks if the function exists
Example 1
Running
1.function_exists('isFinite');
Could return
1.true
function function_exists( function_name ) {
// Checks if the function exists
//
// version: 810.114
// discuss at: http://phpjs.org/functions/function_exists
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Steve Clay
// + improved by: Legaev Andrey
// * example 1: function_exists('isFinite');
// * returns 1: true
if (typeof function_name == 'string'){
return (typeof window[function_name] == 'function');
} else{
return (function_name instanceof Function);
}
}
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
|