Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add numbers in array

const years = [1, 2, 3, 4]
let total = 0;
for (let i = 0; i < years.length; i++) {

    total += years[i]

}

console.log(total)

//answer willl be 10
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #add #numbers #array
ADD COMMENT
Topic
Name
2+7 =