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
Can an anonymous function be assigned to a variable?
What is an empty html tag?
How to convert a string to a number using javascript?
What do you understand by this keyword in javascript?
What is javascript ‘strict mode’?
What is the difference between "var" and "let" keywords?
How to add behavior to an element using javascript?
How to empty an array in JavaScript?
<script type="text/javascript"> function dispValue(e) { v = function (s) { return e.name + ': ' + s } if (e.type == "") return v(e.checked ? "" : ""); else return v(e.value); }
What is the source code for include() & forwrd() method servlet program?
Explain the difference between java and javascript.
How to select an element by id and swapping an image?