Follow the code:
<button onclick="myFunction(1)">Meu botão</button>
<script>
function myFunction(num) {
alert(num);
}
</script>
JSFiddle: link
Anyone can change value using F12.
Change number myFunction(1)
to myFunction(2)
, and then click button, call the javascript function 2 times.
Each time you change the number, it will record somewhere. (If it changes 50 times, it will call the function 50 times)
Is there a way before calling the function, check how many numbers are saved?