JSFiddle - React, Tailwind, and code Playground

JavaScript

/*
      create a function named 'avgNumbers'
       - accept 1 parameter into the function that will be an array of unlimited numbers
       - find the average of all the numbers
       - return the average from the function
       - console.log the answer outside of the function
     */

//Code start here

console.log("1. avg of an array of numbers");
var avgNumbers = function (arr) {
    return arr.reduce(function (a, b) {
        return a + b;
    }, 0) / arr.length;
}

console.log('avg number = ', avgNumbers([1, 2, 3, 4, 5]));