What is missing in my code?
function numberTally(numList) {

var evenTotal = 0;
var oddTotal = 0;

for (var i = 0; i <= numList.length; i++) {

if i % 2 { // i is odd

oddTotal += numList[i];
// or oddTotal = oddTotal +
numList[i];

}
else { // i is even

evenTotal + numList[i];

}
}
alert(oddTotal);
return evenTotal;

}


No Answer is Posted For this Question
Be the First to Post Answer

Post New Answer

More JavaScript Interview Questions

How to use strings as array indexes using javascript?

0 Answers  


What is triple dot in javascript?

0 Answers  


Why extending array is bad idea?

0 Answers  


What is the difference between local storage & session storage?

0 Answers  


Is javascript necessary for web development?

0 Answers  






What is the difference between let and var?

0 Answers  


Explain higher-order functions in javascript?

0 Answers  


What is lambda in programming?

0 Answers  


What does clean white space mean?

0 Answers  


Explain how can you submit a form using JavaScript?

0 Answers  


What is difference between ajax and javascript?

0 Answers  


How do you round a value in javascript?

0 Answers  


Categories