Below is my solution to the HackerRank "Simple Array Sum" challenge. In order to pass the tests, you'll need to iterate through the array of integers and sum them up. I chose to do this using the reduce method. You'll then need to print the resulting sum to the console.

function main() {  
    let n = parseInt(readLine()),
        arr = readLine().split(' ').map(Number),
        sum = arr.reduce(function(acc, number) {
            return acc + number;
        }, 0);

    console.log(sum);

    return sum;
}