You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
var array = [1, 2, 3, 4, 5, 6],
|
|
s = 0,
|
|
p = 1,
|
|
i;
|
|
for (i = 0; i < array.length; i += 1)
|
|
{
|
|
s += array[i];
|
|
p *= array[i];
|
|
}
|
|
console.log('Sum : '+s + ' Product : ' +p);
|