w3ka dev - share the knowledge .NET
How to check if JavaScript function exists?
Checking if function exists differs from the regular object checking. In order to ensure a function exists you can use typeof operator for the verification.
if (typeof myFunctionName === 'function') {
myFunctionName();
}
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment