-->
Showing posts with label function function and calling in JS. Show all posts
Showing posts with label function function and calling in JS. Show all posts

Saturday, June 28, 2025

JavaScript Program to use function to find sum of series– Function concept in JS with Examples

 

JS Function programs collection

JS program to show the concept of function

JS program to find sum of series using function  sum()

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>sum of series</title>

</head>

<body>

<h1>the sum is</h1>

<script type="text/javascript">

function sum()

{

var i,sum=0;

for(i=1;i<=100;i++)

{

sum+=i;

}

document.write(sum);

}

</script>

<script type="text/javascript">

sum();

</script>

</body>

</html>