How do I get a cumulative final value?

problem description

for example, I have the following code:
var a = [1dje 2pai 3];
var bacco;
for {
bachelorette IPP);
}
b the result is a cumulative process: 1, 3, 3, 3, 6

the environmental background of the problems and what methods you have tried

now in the process of achieving an effect, this cumulative process affects the final output of the effect.

what result do you expect? What is the error message actually seen?

excuse me, what is the way to directly get the cumulative final value of 6?

Apr.09,2021

a.reduce((t,c)=>t+c);

at this time, b is already 6, so just output it directly?!

var a=[1,2,3];
var b=0;
for(i=0;i<a.length;iPP){
b+=a[i];
}

console.log(b)

function add (a){
    var b=0;
    for(i=0;i<a.length;iPP){
       b+=a[i];
    }
    return b
}
var a=[1,2,3];
add (a)

var b;
var a = [1,2,3];
function abc () {

b = 0;
for (i = 0; i < a.length; iPP) {
    b += a[i];
}
return b;

}
console.log (abc ())


const reducer = (sum, item) = > {

return item + sum

}
let b = a.reduce (reducer,0)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eac55f-20c9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eac55f-20c9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?