function mean(numbersArr)
{
    let arrLen = numbersArr.length;
    if (arrLen > 0) {
        let sum: number = 0;
        for (let i of numbersArr) {
            sum += i;
        }
        return sum/arrLen;
    }
    else return "Not defined";
}

alert( mean( [1,2,3,4,5] ) );   
alert( mean( [] ) );