How do I add all the numbers in an array? JavaScript

Опубликовано: 02 Август 2026
на канале: Ефим Рябов
6,348
105

We add the numbers in the array using the map () method.
Printed version: https://efim360.ru/javascript-kak-slo...

00:00 Array of numbers
00:28 The map () method
01:20 Calling the map () method with two parameters
02:30 The map () method returned a new array
03:30 We found an item with a sum in the array
03:50 Inverted the new array
04:30 More examples

ECMAScript Standard - Array Objects - https://tc39.es/ecma262/#sec-array-ob...
Map () method - https://tc39.es/ecma262/#sec-array.pr...
Reverse () method - https://tc39.es/ecma262/#sec-array.pr...

Thanks for watching!

How do I add numbers in JavaScript using arrays and their methods? The video shows an example of an array of five numbers that are added sequentially to each other and returned as a new array.

The results of the increments are stored in a separate variable and are elements of the new array. After the map () method works, we get an array of increments, in which the last element of the array is the sum of all the numbers in the original (old) array.

After that, the new array is flipped and its last element becomes the first. We get the value of the first element of the array using square brackets and index zero.