Question: Language JavaScript (Node.js) Autocomplete Ready O ? 1 > 'use strict'; - 1. calculateAverage 26 27 /* 28 * Complete the calculateAverage' function below. 29

Language JavaScript (Node.js) Autocomplete Ready O ? 1 > 'use strict'; - 1. calculateAverage 26 27 /* 28 * Complete the calculateAverage' function below. 29 Write a function called calculateAverage which accepts an array of numbers. The function should return the average or mean of all numbers in the array. If the array is empty, return 0. 30 31 * The function is expected to return an integer. * The function accepts an array of integers called numbers as a parameter. */ 32 33 34 function calculateAverage (numbers) { // Write your code here 35 calculateAverage ([1,3,2]) // 2 calculateAverage ([4,10,4,10]) // 7 calculateAverage ([100]) // 100 calculateAverage([]) // O 36 37 } 38 39 > function main() {
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
