var mountains = [1819,2003,876,2840,1723,1673,3776,2848,1592,922]
var threeLargestArray = findIndicesOfMax(mountains, 3);

for (var i = 0; i < threeLargestArray.length; i++){
    console.log(mountains[threeLargestArray[i]]);
}

function findIndicesOfMax(inputArray, count) {
    var outputArray = new Array();
    for (var i = 0; i < inputArray.length; i++) {
        outputArray.push(i);
        if (outputArray.length > count) {
            outputArray.sort(function(a, b) { return inputArray[b] - inputArray[a]; });
            outputArray.pop();
        }
    }
    return outputArray;
}