I have successfully tried to create a function where the numerical value of all elements in an array are being added to a total number, but there seems to be a problem when it comes to assigning different variants for array's length and the array itself respectively.
So here's what ostensibly doesn't work for now
var firstValue = 0;
var secondValue = 0;
var firstArray = [8, 5];
var secondArray = [10, 10];
function calculateSum(x,y) {
for ( var i = 0; i < y.length; i++) {
x += y[i];
}
return x
}
calculateSum(firstValue, firstArray);
console.log(calculateSum);