Wyatt M. answered 04/17/20
Experienced Silicon Valley software developer
A function in Javascript named theMean would start off with the line:
function theMean() {
Then you would add the arguments to the function:
function theMean(array1, array2, array3) {
Inside of the body of the function you would then take the average of the arrays. You would want to take the sum of each item in the three arrays and divide them by the total amount of items in the array.
For an array named array you would take the sum by looping through each item and counting them up.
let total = 0;
const length = array.length;
for (let i = 0; i < length; i += 1) {
total += array[i];
}