1int[] a = {10,20,30,40,50};
2int sum = IntStream.of(a).sum();
3System.out.println("The sum is " + sum);
4
1var numbers = [10, 20, 30, 40]
2var sum = 0;
3for (var i = 0; i < numbers.length; i++) { sum += numbers[i]}
1const numbers = [10, 20, 30, 40]
2add = (a, b) => a + b
3const sum = numbers.reduce(add)