Add sums of array. Display one output

前端 未结 3 406
被撕碎了的回忆
被撕碎了的回忆 2021-01-26 01:02

Update: The answer to this question is bellow. Thanks to dougtesting on a different thread. add array together, display sum

function hello() {
    var arr = [];
         


        
3条回答
  •  心在旅途
    2021-01-26 01:11

    In your loop you're referencing arrEquals like for (var a = 0; a < arrEquals; a++){. you need to reference it like for (var a = 0; a < arrEquals.length; a++){ because just referencing the array doesn't tell javascript how long it is, or what number to count to. the .length returns a number, that number is how many items are in the array.

提交回复
热议问题