How to know how many times a function has been executed?

Asked

Viewed 493 times

1

Is there any way to know how many times the following function has been executed Ps: this function is clicked on the element.

function popBaloon (object) {
object.setAttribute("class", "hideBaloon");}

I wonder if there is a way to create a function that counts how many times the above function has been executed.

  • 1

    Usually staff creates a variable to store the count value.

  • Friend if this function is being called in the click the element, then we can say that you want to count the clicks on the element, so just create a function that increments some variable and call it in the click of the element..

  • 1

    You can count clicks through a variable: Example: javascript&#xA;<script type="text/javascript">var clicks = 0;</script>&#xA;<input value="Click" type="button" onclick="clicks++">&#xA;

  • There are several ways to do this, database, cookies, etc... It depends on what you want to do.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.