Sum Up an Array of Numbers : Frontend Coding Exercise

Badge granted! One stylistic comment is that your array numbers can be in a single line:

let numbers = [4, 10, 5, 7, 13, 20];
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title> Sum Up an Array of Numbers </title>
</head>

<body>
    <script>
    
let numbers = [4, 10, 5, 7, 13, 20];
let summation = 0;
function arraysum(){

for(let i=0; i<numbers.length;i++)
{
let sum1 = numbers[i];
summation += sum1;
}
console.log(summation);
}
arraysum();

    </script>
    
</body>
</html>
1 Like

@carlcortez1 - nicely done! You have been granted the badge :slight_smile: