Write a JavaScript program to display sum and product of array elements.
<html>
<head>
<title>Display sum and product of array elements</title>
<script type="text/javascript">
var arr = [13, 56, 7, 23, 1, 7, 8];
var sum=0, product = 1;
for(var i=0; i<arr.length; i++)
{
sum += arr[i];
product *= arr[i];
}
document.write("Array elements are " + arr + "<br />");
document.write("<h3>Sum : " + sum + "</h3>");
document.write("<h3>Product : " + product + "</h3>");
</script>
</head>
<body>
</body>
</html>
