What is 9128 being added instead of 1?

I was trying to add 1 to the number 0, every time I click on the paragraph, using the “onclick” keyword.
9128 was added to “a” every time I clicked on the paragraph, instead of 1.
The code is as follows and I have attached the screenshots.

<!DOCTYPE html>
<html>
<head>
	<title>trial.html</title>
</head>
<body>

<p id="output" onclick="change_paragraph_text()"> Default Text </p>
<script type="text/javascript">
var a = 0;
	function change_paragraph_text() {
		 document.getElementById("output").innerHTML = a;
		 a++;
		 change_paragraph_text();
		 }
		 var name = "Lohith";
	     document.write(name);

</script>
</body>
</html>

Hi @rdlohith,

You are calling the change_paragraph_text inside change_paragraph_text and it is a recursive call without any exit statement.
The correct code would be-

<!DOCTYPE html>
<html>
<head>
	<title>trial.html</title>
</head>
<body>

<p id="output" onclick="change_paragraph_text()"> Default Text </p>
<script type="text/javascript">
var a = 0;
function change_paragraph_text() {
  a++;
  document.getElementById("output").innerHTML = a;
		 
}
var name = "Lohith";
document.write(name);

</script>
</body>
</html>

Do let me know in case you need further assistance.

Thank you so much sir.