I have a question that involves calculating the sum of ten natural numbers, but for some reason the code provided is not working as expected.
<!DOCTYPE html>
<html>
<head>
<title>Sum of first 10 Natural numbers</title>
</head>
<body>
<script>
var sum = 0, n;
parseInt(prompt("Enter the number: "));
for (let i = 0; i <= n; i++) {
sum += i;
}
alert("Sum of Numbers: " + sum);
</script>
</body>
</html>