Given the following code: (Code has to do with JavaScript) var myArray = [1,2,3,
ID: 3685334 • Letter: G
Question
Given the following code: (Code has to do with JavaScript)
var myArray = [1,2,3,4,5,6];
function someFunc(array) {
var s = 0;
for (var i = 0; i < array.length; i++) {
s = s + array [ i ];
}
return (s / array.length);
}
var a = someFunc (myArray);
What will variable a's value be after the code is finished? What is the purpose of the function someFunc?
A. Value: 4
The factorial value of all myArray's numbers
B. Value: 3.5
The average value of all numbers in myArray
C. Value: NaN
It doesn't do anything
D. Value: 21
Is the sum of all values
E. Value: 3.5
Some random number
Explanation / Answer
Bellow is the answer
B. Value: 3.5
The average value of all numbers in myArray
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.