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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment