In some scenarios we might need to count the number of times a particular user has clicked a button or any other element in a web page. There is no direct way like a static variable to count the number of times the user has clicked .
if ( typeof addCategory.no == ‘undefined’ )
addCategory.no =addCategory.no +1;
<input type=button onclick=”addCategory()”>
addCategory.no—–>contains total number of times the addCategory() get invoked.
no—-> is variable name. Here it acts as member variable for addCategroy() function.