for loop | var numbers = [796,830,266,879,743,733,828,796,479,365,116,406,973,221,944,295,931,15,238,377,952,343,729,829,490,651,402,183,130,590,391,812,41,701,585,782,412,403,831,125,955,825,913,962,114,414,537,897,254,923,418,338,685,762,327,406,732,93,923,562,864,244,358,537,201,404,689,201,609,371,94,64,377,627,662,468,154,577,211,223,593,791,980,226,212,212,117,265,856,606,831,877,688,412,908,803,477,819,615,270,401,454,431,848,189,65,373,502,334,792,665,122,929,122,709,652,489,678,471,110,823,237,929,69,964,119,426,277,751,860,68,194,801,721,365,634,151,389,112,808,451,97,186,523,274,503,60,81,208,987,195,729,752,628,51,855,77,845,413,473,973,635,515,784,963,260,980,907,288,50,767,613,319,697,624,673,599,818,706,119,960,312,108,442,520,217,707,666,776,369,894,846,961,296,9,221,866,444,499,795,262,843,589,446,199,276,231,306,86,572,897,962,764,215,284,470,247,384,355,58,637,324,554,330,386,391,670,895,904,19,759,448,921,528,852,453,475,69,88,598,290,505,134,962,197,568,256,407,706,527,718,261,234,892,171,850,370,349,908,751,852,717,403,204,526,52,4,334,907,490,525,557,224,447,160,532,393,602,286,790,81,52,397,595,525,490,784,382,252,130,17,189,811,381,790,564,962,730,130,671,446,741,823,502,680,533,515,586,770,294,525,718,239,997,242,788,974,90,63,753,99,975,135,584,412,102,656,228,484,992,182,850,985,176,252,514,894,636,498,896,513,984,542,905,257,190,813,199,183,277,50,386,792,69,442,46,859,663,65,747,827,760,649,632,405,129,113,97,184,794,251,998,816,153,533,27,951,532,271,901,555,122,881,64,749,710,834,626,130,569,243,460,57,912,73,716,105,974,277,356,8,839,840,280,2,563,511,102,531,896,906,890,780,47,219,248,62,417,758,861,223,722,35,541,693,485,489,310,523,905,782,769,792,760,472,640,888,437,787,380,53,93,232,105,203,668,936,914,88,965,908,227,718,695,347,942,339,844,658,782,525,355,940,916,319,86,522,456,577,91,17,25,890,898,944,222,549,85,410,839,587,8,313,78,28,821,373,755,515,821,131,883,37,896,445,597,524,709,627,184,499,625,81,98,765,26,334,388,37,332,531,808,969,764,629,174,771,346,247,542,804,72,830,237,265,827,853,238,902,125,419,411,346,769,331,259,281,98,8,825,797,500,718,791,936,197,68,259,623,93,330,598,507,303,197,617,524,749,823,66,242,300,864,290,464,918,142,225,682,919,75,768,431,614,920,837,713,544,502,168,143,608,459,496,136,145,472,785,127,281,166,337,710,546,126,820,514,765,350,5,781,945,799,271,420,391,358,601,525,286,949,900,838,776,425,58,51,404,502,485,806,814,741,184,242,37,560,116,57,38,323,768,249,788,105,975,131,564,530,336,172,667,914,470,490,787,508,537,186,449,388,6,11,741,187,910,121,540,679,798,601,762,300,794,295,29,490,665,983,217,625,154,751,890,227,689,460,543,468,766,600,851,315,804,694,190,204,797,748,869,602,782,993,583,865,600,722,701,292,693,956,426,915,139,582,408,242,772,713,813,625,132,505,429,520,241,640,777,11,427,845,978,570,125,434,763,987,891,152,99,918,338,81,848,12,635,157,926,412,389,428,188,106,529,217,240,504,350,858,477,550,804,961,144,730,31,816,127,821,897,339,898,185,401,922,166,516,937,292,424,160,462,874,657,456,615,833,912,506,312,336,280,188,911,91,299,658,233,854,486,930,516,718,355,148,28,978,60,6,656,780,751,498,841,508,314,894,578,686,410,536,956,976,5,839,343,122,36,149,464,167,518,946,527,265,796,200,983,362,692,501,768,944,954,913,649,594,713,979,981,892,449,80,950,679,960,628,59,68,201,836,476,827,618,577,647,245,48,463,521,70,299,586,920,624,248,580,477,12,809,28,242,894,657,513,128,439,419,501,99,414,482,23,565,902,700,561,136,250,396,431,608,390,920,886,394,842,914,339,82,223,147,489,246,436,145,287,555,448,804,846,140,664,447,404,800,752,243,792,151,505,483,713,838,787,574,394,818,422,452,938,611,629,524,133,712,364,12,4,519,66,470,104,594,774,533,930,162,454,257,957,700,719,544,226,997,882,14,150,968,302,392,942,756,615,773,456,929,188,638,185,973,300,792,215,419,999,203,811,124,775,534,226,682,735,736,153,485,823,701,957,965,34,707,727,794,826,761,734,289];
function arraySum(arr) {
let sum = 0;
for (let i = 0; i < arr.length; i++) {
sum += arr[i]
}
return sum;
}
const sumOfNumbers = arraySum(numbers);
| ready |
reduce | var numbers = [796,830,266,879,743,733,828,796,479,365,116,406,973,221,944,295,931,15,238,377,952,343,729,829,490,651,402,183,130,590,391,812,41,701,585,782,412,403,831,125,955,825,913,962,114,414,537,897,254,923,418,338,685,762,327,406,732,93,923,562,864,244,358,537,201,404,689,201,609,371,94,64,377,627,662,468,154,577,211,223,593,791,980,226,212,212,117,265,856,606,831,877,688,412,908,803,477,819,615,270,401,454,431,848,189,65,373,502,334,792,665,122,929,122,709,652,489,678,471,110,823,237,929,69,964,119,426,277,751,860,68,194,801,721,365,634,151,389,112,808,451,97,186,523,274,503,60,81,208,987,195,729,752,628,51,855,77,845,413,473,973,635,515,784,963,260,980,907,288,50,767,613,319,697,624,673,599,818,706,119,960,312,108,442,520,217,707,666,776,369,894,846,961,296,9,221,866,444,499,795,262,843,589,446,199,276,231,306,86,572,897,962,764,215,284,470,247,384,355,58,637,324,554,330,386,391,670,895,904,19,759,448,921,528,852,453,475,69,88,598,290,505,134,962,197,568,256,407,706,527,718,261,234,892,171,850,370,349,908,751,852,717,403,204,526,52,4,334,907,490,525,557,224,447,160,532,393,602,286,790,81,52,397,595,525,490,784,382,252,130,17,189,811,381,790,564,962,730,130,671,446,741,823,502,680,533,515,586,770,294,525,718,239,997,242,788,974,90,63,753,99,975,135,584,412,102,656,228,484,992,182,850,985,176,252,514,894,636,498,896,513,984,542,905,257,190,813,199,183,277,50,386,792,69,442,46,859,663,65,747,827,760,649,632,405,129,113,97,184,794,251,998,816,153,533,27,951,532,271,901,555,122,881,64,749,710,834,626,130,569,243,460,57,912,73,716,105,974,277,356,8,839,840,280,2,563,511,102,531,896,906,890,780,47,219,248,62,417,758,861,223,722,35,541,693,485,489,310,523,905,782,769,792,760,472,640,888,437,787,380,53,93,232,105,203,668,936,914,88,965,908,227,718,695,347,942,339,844,658,782,525,355,940,916,319,86,522,456,577,91,17,25,890,898,944,222,549,85,410,839,587,8,313,78,28,821,373,755,515,821,131,883,37,896,445,597,524,709,627,184,499,625,81,98,765,26,334,388,37,332,531,808,969,764,629,174,771,346,247,542,804,72,830,237,265,827,853,238,902,125,419,411,346,769,331,259,281,98,8,825,797,500,718,791,936,197,68,259,623,93,330,598,507,303,197,617,524,749,823,66,242,300,864,290,464,918,142,225,682,919,75,768,431,614,920,837,713,544,502,168,143,608,459,496,136,145,472,785,127,281,166,337,710,546,126,820,514,765,350,5,781,945,799,271,420,391,358,601,525,286,949,900,838,776,425,58,51,404,502,485,806,814,741,184,242,37,560,116,57,38,323,768,249,788,105,975,131,564,530,336,172,667,914,470,490,787,508,537,186,449,388,6,11,741,187,910,121,540,679,798,601,762,300,794,295,29,490,665,983,217,625,154,751,890,227,689,460,543,468,766,600,851,315,804,694,190,204,797,748,869,602,782,993,583,865,600,722,701,292,693,956,426,915,139,582,408,242,772,713,813,625,132,505,429,520,241,640,777,11,427,845,978,570,125,434,763,987,891,152,99,918,338,81,848,12,635,157,926,412,389,428,188,106,529,217,240,504,350,858,477,550,804,961,144,730,31,816,127,821,897,339,898,185,401,922,166,516,937,292,424,160,462,874,657,456,615,833,912,506,312,336,280,188,911,91,299,658,233,854,486,930,516,718,355,148,28,978,60,6,656,780,751,498,841,508,314,894,578,686,410,536,956,976,5,839,343,122,36,149,464,167,518,946,527,265,796,200,983,362,692,501,768,944,954,913,649,594,713,979,981,892,449,80,950,679,960,628,59,68,201,836,476,827,618,577,647,245,48,463,521,70,299,586,920,624,248,580,477,12,809,28,242,894,657,513,128,439,419,501,99,414,482,23,565,902,700,561,136,250,396,431,608,390,920,886,394,842,914,339,82,223,147,489,246,436,145,287,555,448,804,846,140,664,447,404,800,752,243,792,151,505,483,713,838,787,574,394,818,422,452,938,611,629,524,133,712,364,12,4,519,66,470,104,594,774,533,930,162,454,257,957,700,719,544,226,997,882,14,150,968,302,392,942,756,615,773,456,929,188,638,185,973,300,792,215,419,999,203,811,124,775,534,226,682,735,736,153,485,823,701,957,965,34,707,727,794,826,761,734,289];
const add = (a, b) => a + b;
const arraySum = (arr) => arr.reduce(add);
const sumOfNumbers = arraySum(numbers);
| ready |