javascript
sum of number - info inte qns
let a = [1,2,3,4,5];
let sum = 0;
for(i=0; i<=a.length; i++) {
sum +=i
}
console.log(sum, "sum")
Output
15 sum
Was this helpful?
Similar Posts
- Get total sum of specif attribute inside of array of objects
- Get the sum of array values using Javascript - Solved
- add sum of numbers of given numbers
- Enter only number field validation redux form
- Convert a Number or Integer to String in Javascript
- Convert a String to Number or Integer in Javascript
- Calculate square root of a number using javascript